How can I write an input selector for the states API? I'm trying to use the #states API but my input selector isn't being picked up.  This is the code I've added to hook_form_alter() in a custom module: 

  case 'my_form':
    $form['revision_information']['#access'] = FALSE;
    $form['field_guide_link_hosting']['#states'] = array(
      'visible' =&gt; array(
        ':input[name="field_guide_types[und]"]' =&gt; array('value' =&gt; 's'),
      ),
      'required' =&gt; array(
        ':input[name="field_guide_types[und]"]' =&gt; array('value' =&gt; 's'),
      ),
    );


And here's the rendered form for field_guide_types:

&lt;div class="form-item form-type-checkboxes form-item-field-guide-types-und"&gt;
  &lt;label for="edit-field-guide-types-und"&gt;How can you help tourists? &lt;span class="form-required" title="This field cannot be left blank."&gt;必須&lt;/span&gt;&lt;/label&gt;
 &lt;div id="edit-field-guide-types-und" class="form-checkboxes"&gt;&lt;div class="form-item form-type-checkbox form-item-field-guide-types-und-o"&gt;
 &lt;input type="checkbox" id="edit-field-guide-types-und-o" name="field_guide_types[und][o]" value="o" class="form-checkbox"&gt;  &lt;label class="option" for="edit-field-guide-types-und-o"&gt;Answer questions and offer information online &lt;/label&gt;

&lt;/div&gt;
&lt;div class="form-item form-type-checkbox form-item-field-guide-types-und-m"&gt;
 &lt;input type="checkbox" id="edit-field-guide-types-und-m" name="field_guide_types[und][m]" value="m" checked="checked" class="form-checkbox"&gt;  &lt;label class="option" for="edit-field-guide-types-und-m"&gt;Meet in person &lt;/label&gt;

&lt;/div&gt;
&lt;div class="form-item form-type-checkbox form-item-field-guide-types-und-s"&gt;
 &lt;input type="checkbox" id="edit-field-guide-types-und-s" name="field_guide_types[und][s]" value="s" class="form-checkbox"&gt;  &lt;label class="option" for="edit-field-guide-types-und-s"&gt;Provide a place to stay (like through AirBNB, CouchSurfing, etc.) &lt;/label&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
drupal_process_states() has a great set of information on handling inputs for different types of input elements. 

You have checkboxes, so you have to use checked assertion. 

case 'my_form':
    $form['revision_information']['#access'] = FALSE;
    $form['field_guide_link_hosting']['#states'] = array(
      'visible' =&gt; array(
        ':input[name="field_guide_types[und][s]"]' =&gt; array('checked' =&gt; TRUE),
      ),
      'required' =&gt; array(
        ':input[name="field_guide_types[und][s]"]' =&gt; array('checked' =&gt; TRUE
      ),
    );


Notice I replaced the value assertion with a checked, and also changed the jQuery selector to use the full name attribute of the checkbox.