Registration content type has a required entity reference field. The widget of this field is a select list, the options are populated with a views entity reference display output. I want to hide(unset) the submit button if the views entity reference display returns no value. I've asked a question here for reference, I'm suggested to post a new question.
1 Answer
You can do this by using hook form FORM ID alter .
Once hooked in you find the $form item for the drop down list. It'll be somewhere like
$form['field_my_entity_ref']['und']['#options']
So you should be able to make a check on the values in that array and if there are none then make the Submit button disabled . My guess is
if ( count($form['field_my_entity_ref']['und']['#options']) < 1 ) {
$form['#submit']['#disabled'] == TRUE;
}
https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7.x/#disabled