Javascript Bind

Bind a single element.

Bind to a single form element in the page.
Binding string means : onChange bind value of field with name 'myName' and look for it into a container with id 'myForm'.

<cfajaxproxy bind="javascript:updateDiv1({myForm:myName})" />
**************************************************************
Js Function
**************************************************************
updateDiv1 = function(data){
document.getElementById('myDiv1').innerHTML = data;
}

Bind to multiple fields

You can bind more that one fields to a js function that act like listener. In this case Railo Ajax will pass a literal object to the listener with both the binded values while adobecf simply skip the second argument.

Bind : Event onChange. Bind values of fields with name 'myName' and 'myAge' contained by an element with id 'myForm2'

<cfajaxproxy bind="javascript:updateDiv2({myForm2:myName},{myForm2:myAge})" />
**************************************************************
Js Function
**************************************************************
updateDiv2 = function(data){
var str = 'My name is ' + data["myName"] + ' and I am ' + data["myAge"] + ' years old';
document.getElementById('myDiv2').innerHTML = str;
}