hook_form_alter function to make field visible and required? I'm trying to build a hook_form_alter function to  make field visible and required.

The form is the checkout form at http://example.com/en/checkout/33

The targeted field are Customer Profile Billing fields that I added at: http://example.com/en/admin/commerce/customer-profiles/types/billing/fields

I tried with:

function MY_MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {   
  if ($form_id == 'commerce_checkout_form_checkout') {
    $form['field_cif_nif_id'] = array(
         // This #states rule says that the "field_cif_nif_id" fieldset should only
         // be shown if the "field_dispongo_de_" form element is set to "CIF/NIF/ID".
        '#states' =&gt; array(
           'visible' =&gt; array(
               ':input[name="field_dispongo_de_"]' =&gt; array('value' =&gt; 'CIF/NIF/ID'),
            ),
        ),
  );

 } 
} 


it simple doesn't work. No errors.

I need to make the 'field_cif_nif_id' visible and required only if 'field_dispongo_de_' has value 'CIF/NIF/ID'

UPDATE:
I forgot to mention that 'field_dispongo_de_' is a 'radio' type field and 'field_cif_nif_id' is a 'input text' type.

UPDATED CODE

It is closer but not working yet. 

function MY_MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {   
  if ($form_id == 'commerce_checkout_form_checkout') {
    $form['customer_profile_billing']['field_cif_nif_id'] = array(
       '#states' =&gt; array(
           'visible' =&gt; array(
               ':input[name="field_dispongo_de_"]' =&gt; array('value' =&gt; 'CIF/NIF/ID'),
            ),
       ),
    );    
 } 
}
Try changing the selector from ':input[name="field_dispongo_de_"]' to the id of the field (#edit-customer-profile-billing-field-dispongo-de-und) as below:

/**
 * Implements hook_form_alter().
 */
function MODULE-NAME_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Check if the form is commerce checkout form.
  if ($form_id == 'commerce_checkout_form_checkout') {
    // Verify the field names are as per the form.
    $form['customer_profile_billing']['field_cif_nif_id']['#states'] = array(
      // This #states rule says that the "field_cif_nif_id" fieldset should only
      // be shown if the "field_dispongo_de_" form element is set to "CIF/NIF/ID".
      'visible' =&gt; array(
        '#edit-customer-profile-billing-field-dispongo-de-und' =&gt; array('value' =&gt; t('cif')),
      ),
    );
  }
}