How to show or hide form field based on query results
I have a form with fields for country and state/province. Initially, the state field is hidden. When the user selects a country, I use a bind expression to get the states (if any) in the selected country. I want to display the state field only if the country has states (since some countries don't). Can someone tell me how to do this? Here's the jquery script that initially hides the State field (and it's label) as well as the form fields:
<script>
$(document).ready(function() {
$('#stateID').hide();
$('#stateIDLable').hide();
});
</script>
Country:
<cfselect name="countryID" query="qryCountries" value="countryID" display="country" />
<div id="stateIDLable">State or Province:</div>
<cfselect id="stateID" name="stateID" bind="cfc:geography.getStates({countryID})" />
Thanks.
PK
