0 Replies Latest reply on Mar 11, 2008 1:12 PM by TomD__

    CFGrid pre-populating CFSelect In CF8

    TomD__
      I am somewhat new to ColdFusion (especially CF8 and AJAX) but have learned quite a bit recently. I have been racking my brain trying to find a solution or methodoly to this simple task.

      I am using CF8 and have created a cfgrid which is populated by a cfc (using the example in Ben & Ray's new WACK book). The grid should not allow editing. This works fine. My next goal was to have a series of cfinputs and cfselects bound to this grid that would display under the grid to allow for editing. There obviously is no problem binding the cfinput to the cfgrid. The problem that I'm running into is binding the cfselect to the the cfgrid.

      In CF8, the bind in cfselect allows you to bind to an array of valid inputs. What I'm trying to accomplish is having the initial value of the cfselect (or selected value) be the corresponding row selected in the cfgrid. In other words, if you select another row on the cfgrid, all values in the edit screen are updated, including the cfselect. Right now, only the cfinput tags are updated when the active row on the cfgrid is changed.

      I tried playing with onchange, cfproxy, options in cfselect, etc.but seem to have hit a brick wall. Does anyone know of any solutions?

      Thanks in advance.





      <cfform name="MainIndex"
      format="html"
      action="portalcfc.cfc?method=indexSelect">

      <cfgrid name="contact_grid"
      format="html"
      pagesize="10"
      striperows="yes"
      bind="cfc:portalcfc.browse({cfgridpage},
      {cfgridpagesize},
      {cfgridsortcolumn},
      {cfgridsortdirection})">

      <cfgridcolumn name="OBJECT_ID"
      width="100"
      header="Object ID">

      <cfgridcolumn name="CONTACT_NUMBER_CODE"
      width="100"
      select="yes"
      header="Contact Type">

      <cfgridcolumn name="CONTACT_NAME"
      width="100"
      header="Contact Name">

      <cfgridcolumn name="CONTACT_NUMBER"
      width="100"
      header="Contact Number">

      <cfgridcolumn name="EMAIL_ADDRESS"
      width="100"
      header="Email Address">

      <cfgridcolumn name="EMERGENCY_BROADCAST"
      width="100"
      header="Emergency Broadcast">

      </cfgrid>

      <cfinput type="text"
      name="OBJECT_ID"
      label="Object ID"
      bind="{contact_grid.OBJECT_ID}">

      <cfselect name="CONTACT_NUMBER_CODE"
      label="Contact Type"
      id="CONTACT_NUMBER_CODE"
      value="CONTACT_NUMBER_CODE"
      bind="cfc:portalcfc.getContactNumberCode()"
      bindonload="true">
      </cfselect>

      </cfform>