Field available only when a value from a Hierarchical Select is chosen I am using the Hierarchical Select module to allow users to first select a continent and then a country. I wish to enable a field only when a user selects North America (first selection) and USA (second selection).
I hope someone could explain how I achieve this.
I created a module that implemented the node_validate function and from the values selected determined if child taxonomies existed when the form was submitted. If they did then obviously the user had not made a selection from the second drop down list.
This is the code I wrote.
function mp_admin_node_validate($node, $form, &amp;$form_state) {     
    if ($form[&quot;#form_id&quot;]==&quot;jobs_node_form&quot;) {
        $loc = taxonomy_get_children( $node-&gt;field_tax_regions[und][0][tid]);     
        if ((count($loc)&gt;0) &amp;&amp; ($loc)) {
            form_set_error(&quot;field_tax_regions&quot;, t('Location region is required.')); 
        } 
    }
}