Wednesday, January 09, 2008

Binding to an HTML cfgrid

Wanna bind to an HTML cfgrid, and having trouble finding the correct syntax? Here it is:

bind="{gridName.columnName}"

I searched for a couple of hours, and could only find the flash forms syntax. Then I found it documented here:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=ajaxui_5.html#1137151


Here is an example using cfinput to bind to the cfgrid :

<cfgrid name="user_grid" query="get_users">
<cfgridcolumn name="last_name">
<cfgridcolumn name="first_name">
<cfgridcolumn name="age">
</cfgridcolumn>

<cfinput type="text" name="the_last_name" bind="{user_grid.last_name}">

There you go. Enjoy.

2 comments:

Andrew said...

Thank you :)

Anonymous said...

Thanks very useful. How can I do the same thing with a cfgrid but bind a cfselect? Thanks