1 Reply Latest reply on Nov 1, 2014 5:11 AM by BKBK

    AJAX-Powered Related Select Boxes -

    SarasotaTim

      Hi folks...I'm being driven crazy by this seemingly simple task.

       

      I have 4 selectboxes, each AJAX-driven, grabbing items from a database, and then populating the next box in turn.  Once a submit button is clicked next to the set of dropdowns, the information in the boxes are sent to a processing script where session variables are set and returned.

       

      They all preload by default. They all properly load the next dropdown as you'd expect.

       

      The problem is, I've found that if none of the boxes are touched and the default values are left, an error occurs when the submit button is clicked, and after dismissing the error popup, the 4th box becomes empty.  This only happens if the 4th (last) dropdown is left to its default value.  Once any other value other  than the default one is selected, everything works as expected.

       

      The error:

      Bind failed for select box Transact, value and/or display attributes must be specified on the cfselect tag when binding to a query.

       

      The form:

       

      <tr>

      <td align="left">

      <cfif isDefined("form.submit")><cfselect name="Location"  display="Location" bind="cfc:webapps.checklist.cfc.queries.getLocations()" bindonload="true" selected="#form.Location#" /><cfelse><cfselect name="Location"  display="Location" bind="cfc:webapps.checklist.cfc.queries.getLocations()" bindonload="true" /></cfif>

      </td>

      </tr>

      <tr>

      <td align="left">

      <cfif isDefined("session.itemapplication") AND session.itemapplication NEQ "">

      <cfselect name="Application" selected="#session.itemapplication#"  display="Applicat" bind="cfc:webapps.checklist.cfc.queries.getApplications({Location})" bindonload="false" />

      <cfelse>

      <cfselect name="Application" selected="#form.Application#"  display="Applicat" bind="cfc:webapps.checklist.cfc.queries.getApplications({Location})" bindonload="false" />

      </cfif>

      </td>

      </tr>

      <tr>

      <td align="left">

      <cfif isDefined("session.itemcategory") AND session.itemcategory NEQ "">

      <cfselect name="Category" selected="#session.itemcategory#"  display="Category" bind="cfc:webapps.checklist.cfc.queries.getCategories({Application})" bindonload="false" />

      <cfelse>

      <cfselect name="Category" selected="#form.Category#"  display="Category" bind="cfc:webapps.checklist.cfc.queries.getCategories({Application})" bindonload="false" />

      </cfif>

      </td>

      </tr>

      <tr>

      <td align="left">

      <cfif isDefined("session.transaction") AND session.transaction NEQ "">

      <cfselect name="Transact"  required="yes" size="1" message="Please select a transaction before continuing." selected="#session.transaction#" value="Transact" display="Transact" bind="cfc:webapps.checklist.cfc.queries.getTransactions({Category})" bindonload="false" />

      <cfelse>

      <cfselect name="Transact" required="yes" size="1" message="Please select a transaction before continuing." value="Transact" display="Transact"  selected="#form.Transact#" bind="cfc:webapps.checklist.cfc.queries.getTransactions({Category})" bindonload="false" />

      </cfif>

      </td>

      <td><cfinput type="submit" name="submit" value="Show Items"></td>

      </tr>

       

      Untitled-1.jpg

       

      2.jpg

      It seems like for whatever reason, the script has a problem with the default value loaded for that last box.  I've checked the database, nothing strange about the values loaded by default at all.  Any ideas guys??

       

      Thanks in advance!

       

      T