How do I make a field not mandatory?

Hi @nef,

To make a mandatory field optional, or vice versa, you’ll need to edit both the form class (when the check is enforced on the server side) and the template (where the required status is flagged in the user interface). For the registration form, that is…

  • lib/pkp/classes/user/form/RegistrationForm.inc.php:
    $this->addCheck(new FormValidator($this, 'country', 'required', 'user.profile.form.countryRequired'));
  • lib/pkp/templates/frontend/components/registrationForm.tpl (or the equivalent template in your theme):
    <div class="country">
                          <label>
                                  <span class="label">
                                          {translate key="common.country"}
                                          <span class="required">*</span>
                                          <span class="pkp_screen_reader">
                                                  {translate key="common.required"}
                                          </span>
                                  </span>
                                  <select name="country" id="country" required>
                                          <option></option>
                                          {html_options options=$countries selected=$country}
                                  </select>
                          </label>
                  </div>
    

Regards,
Alec Smecher
Public Knowledge Project Team