Question: How do I require the first and last names on Individuals?

I need to require some global fields in the CiviCRM backend GUI. Specifically, I need to require the First and Last name for individuals on the standard individual create/edit backend webforms.

I thought there was an admin page to set this, but can't find it right now and I suspect other people will be interested in the answer too.

3 Answers 3


You can make any fields "required" when they are part of a profile.

Admninister > Customize data and screens > Profiles > Fields > Edit


You can do that developing a custom extension. As far as I know, there is no way to configure mandatory fields from the UI.

How to create an extension here or you can use use civix. In your extension, in the main extension's .php file, you can use civicrm hooks, in this case:

hook_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors )

For your example, let's say I create my extension as org.civicrm.myextension. In myextension.php add this for making First Name mandatory:

function myextension_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors ){
    if ( $formName == 'CRM_Contact_Form_Contact' ) {
       // ensure that first name is not empty
       $first_name = CRM_Utils_Array::value( 'first_name', $fields );
       if ( empty($first_name) ) {
          $errors['first_name'] = ts( 'First Name is a required field' );

Might be simpler and easier to add this behavior via jQuery / javascript and include it in an extra custom template file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.