Answers.Body: <p>You can make any fields "required" when they are part of a profile.</p>
  
  <p>Admninister > Customize data and screens > Profiles > Fields > Edit</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-20T17:45:05.437Z
Answers.LastActivityDate: 2015-05-21T12:42:43.997Z
Answers.LastEditDate: 2015-05-21T12:42:43.997Z
Answers.UserDisplayName: Yossi
Answers.Body: <p>You can do that developing a custom extension. As far as I know, there is no way to configure mandatory fields from the UI.</p>
  
  <p>How to create an extension <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension" rel="nofollow">here</a> or you can use use <a href="https://github.com/totten/civix/" rel="nofollow">civix</a>.
  In your extension, in the main extension's .php file, you can use civicrm hooks, in this case:</p>
  
  <pre><code>hook_civicrm_validateForm( $formName, &amp;$fields, &amp;$files, &amp;$form, &amp;$errors )
  </code></pre>
  
  <p>For your example, let's say I create my extension as <strong>org.civicrm.myextension</strong>.
  In myextension.php add this for making First Name mandatory:</p>
  
  <pre><code>function myextension_civicrm_validateForm( $formName, &amp;$fields, &amp;$files, &amp;$form, &amp;$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' );
         }
      }
      return;
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-21T17:16:28.073Z
Answers.LastActivityDate: 2015-05-21T17:16:28.073Z
Answers.UserDisplayName: luciano_s
Answers.Body: <p>Might be simpler and easier to add this behavior via jQuery / javascript and include it in an extra custom template file.</p>
  
  <p><a href="https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates" rel="nofollow">https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T02:15:01.873Z
Answers.LastActivityDate: 2015-05-22T02:15:01.873Z
Answers.UserDisplayName: Donald Lobo
Body: <p>Question:  How do I require the first and last names on Individuals?</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
Tags: <custom-fields>
Title: Require non-custom fields?
ThreadText: # Require non-custom fields?
  
  (Asked by: username_0 on 2015-05-20)
  
  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.
  
  **Tags:** custom-fields
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2015-05-20. Score: 5
  
  You can make any fields "required" when they are part of a profile.
  
  Admninister > Customize data and screens > Profiles > Fields > Edit
  
  
  ---
  
  ### Answer by username_2 on 2015-05-21. Score: 3
  
  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' );
         }
      }
      return;
  }
  
  
  ---
  
  ### Answer by username_3 on 2015-05-22. Score: 1
  
  Might be simpler and easier to add this behavior via jQuery / javascript and include it in an extra custom template file.
  
  <https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates>
  
  
  ---
  
  