0 Replies Latest reply on Nov 22, 2009 11:19 AM by pbk-nFjYI4

    Using jquery to hide/show field based on query results

    pbk-nFjYI4

      I have a form that includes fields for country and state/province.  Initially, the state field is hidden.  When the user selects a country, I use a bind expression in the state field to get the states 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 relevant stuff:

       

      <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.

         Pete