hiding field -reference option limit Helloo !
I am using the D7 reference option limit module. I have two fields &quot;primary&quot; and &quot;secondary&quot; and I managed to reduce the choices of secondary based on the value of primary using this module. Both of them are required field in the user registration form.
I have a small question, when I set no value for primary, I get for the secondary field: No options are available for the current form values. Try selecting different values for the following fields: Primary.  This is the good behaviour that I want but I want to hide secondary when no value is set for primary instead of displaying this message..
Is that possible? In other words I want to keep secondary hidden until primary has a value.
have you try any alter functions to implement ?
if you can try with alter then try #states in hook_form_alter() to hide field, if primary field default value is empty/null.
here is e.g
/**
 * @param type $form
 * @param type $form_state
 * @param type $form_id
 * Implements hook_form_alter()
 */
function hook_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'form_id') {
    // Hide secondary field.
    if (isset($form['secondary_field'])) {
      $form['secondary_field']['#states'] = [
        'visible' =&gt; array(
          'input[name=&quot;primary_field&quot;]' =&gt; array('!value' =&gt; ''),
        ),
      ];
    }
  }
}

'input[name=&quot;primary_field&quot;]' =&gt; array('!value' =&gt; ''), change this as per need i.e if its select list then 'select[name=&quot;primary_field&quot;]' =&gt; array('!value' =&gt; ''), etc.
hope this will solve your issue.