Voting starts in March for the Drupal Association Board election.
I have a problem. I want to hide fields on user_registration form.
Im my module on hook_form_user_register_form_alter I have the following code:
<?php $form['switch'] = array( '#type' => 'checkbox', '#title' => t('Type'), ); $form['field_name']['#states'] = array( 'visible' => array( // action to take ':input[name="switch"]' => array('checked' => TRUE) ) ); ?>
In detail I have a checkbox and depending on state the field "Name" should not be visible. So I added the #states attribute to it.
But as a result. Nothing happens. Seems only to work with my own custom form elements.
Is there a way to achieve this???
Any help is welcome.