I have a cfselect which is binded to a query using ajax proxy. I do a update and addition of new values corresponding to the cfselect in a cfwindow of mine I want the user to get always the latest and updated list in the cfselect. Is there a function which i can invoke in the onclick and intern will refresh the cfselect. Please help!!!
1 Answers
Arasu,
It is a big coincidence that I too had a similar sceario to be dealt with. However it goes like this.
The solution is: ColdFusion.Bind.assignValue(,, )
I have my cfselect which is bound to a query. The values associated to my bind query is updated in another page of my website (in your case a cfwindow). so I too need my users to get the latest set of values in the cfselect each time they select it. so here comes the magic. I invoke the ColdFusion.Bind.assignValue(,,) in the onClick of my cfselect, where:
name: name of the control (here it is the cfselect name) you want to be binded
attribute name: the attribute of the control to assign the values to
function: function responsible to bind data to the control.
My code goes:
<cfform style="align:centre" id="frm_drpDwnBus" name="frm_drpDwnBus">
<cfinput name="hdnrr" value="#rrSbstring#" type="hidden">
<cfselect name="dpDwnBs" bindOnLoad="true"
bind="cfc:getCalculatorData.getAllBus(hdnrr.value)"
value="busType_id_pk"
display="busType_name"
queryposition="below" onclick="javascript:refresh(hdnrr.value)" >
<option value="0" on>Select a Bus</option>
</cfselect>
</cfform>
And my javascript code is:
<cfajaxproxy cfc="Calculator.getCalculatorData" jsclassname="cfcCalcu">
var dataCalcu= new cfcCalcu();
function refresh(s)
{
ColdFusion.Bind.assignValue('dpDwnBs','value', dataCalcu.getAllBus(s))
}
Now what I would recommend you to do is invoke the 'refresh' function when you have done any update/deletion in your cfwindow code. this would update the binding to your cfselect.

- 3,722
- 4
- 31
- 34