Ask a Question related to Macromedia ColdFusion, Design and Development.
-
-
how to use click event on a checkbox in cfgrid
I am using checkboxes in a cfgrid by putting type="boolean" in my cfgridcolumn tag The problem is, I need a click event to be fired when any of the... -
checkbox in cfgrid
Hi, is it possible to add a column of checkboxes in cfgrid so that after binding, the checked records will be passed into a query? Thanks a lot. -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
Help with CFGrid
How can I get a hyperlinked file deleted from the server when the delete action occurs in the Grid, which the action is also followed through to the... -
CFGrid: Checkbox selected then insert date
I have a CFGrid that's working great, one additional enhancement would be the icing on the cake but I don't know how to do this. One column in my... -
Mike Nimer #2
Re: CFGRID & Checkbox
You need to set the checkbox selected value using the onChange of the grid.
try this.
-----------
<cfscript>
q1 = queryNew("id,firstname,lastname,opt");
queryAddRow(q1);
querySetCell(q1, "id", "1");
querySetCell(q1, "firstname", "mike");
querySetCell(q1, "lastname", "nimer");
querySetCell(q1, "opt", "false");
queryAddRow(q1);
querySetCell(q1, "id", "100");
querySetCell(q1, "firstname", "john");
querySetCell(q1, "lastname", "doe");
querySetCell(q1, "opt", "true");
</cfscript>
<cfform action="#cgi.script_name#" name="form1a" format="flash" width="600"
height="300">
<cfgrid
name="grid1"
width="500"
height="200"
query="q1"
onChange="cbox1.selected=UtilFunctions.isTrue(grid 1.dataProvider[grid1.selectedIndex]['opt'])">
</cfgrid>
<cfinput type="Checkbox" name="cbox1" label="option">
<cfinput type="submit" name="submitBtn" value="submit field"><br>
</cfform>
-----------
hth,
---nimer
"ArtNirvana" <webforumsuser@macromedia.com> wrote in message
news:cutqkt$buo$1@forums.macromedia.com...>I want to bind the checkbox so that it is checked or unchecked based on the
> value in the field of the grid. The field is boolean in the SQL Server
> 2000
> Database.
>
> I would imagine te bind goes something like:
>
> *Clearly, this is the concept and not the actual actionscript since I know
> little of actionscript
> <CFGRID name = "gridname" onchange="formname.inputname.value =
> formname.gridname.currentrecord.field.value">
> YADA YADA YADA - GRID STUFF HERE
> </CFGRID>
>
> I am configuring a Tabbed Navigator so that a record selected in the grid
> populates another tab with the values from the record. Then the record can
> be
> edited, validated and submitted from the second tab. I have it working for
> textboxes and cfselect, but don't know the flash actionscript well enough
> to
> bind a checkbox (I found the text select method easily and eventually
> found
> another reference to a cfselect and modified it to get it working). The
> values
> in the checkbox DO NOT need to update the grid (it is setup in select mode
> and
> the update only needs to go one way).
>
> Thanks
>
Mike Nimer Guest
-
ArtNirvana #3
Re: CFGRID & Checkbox
Well, your script worked as an example, but I coult not get it to function with
my actual cfform and database.
The good news is that I figured out a method that would work.
With a grid and a checkbox the below line needs to be added to the onchange
event:
onchange="checkboxname.selected=(eval(gridname.sel ectedItem.fieldname));"
*** note -Checkboxname, Gridname and Fieldname refers to the properties that
are set based on the actual names the user chose in their code when they add
these items.
I have no idea why the other method wouldn't work with my database (SQL Server
2000). Like I said the sample worked but the onchange code wouldn't work with
my particular grid connecting to my database, but the above does work.
ArtNirvana Guest
-
ArtNirvana #4
Re: CFGRID & Checkbox
Well, your script worked as an example, but I coult not get it to function with
my actual cfform and database.
The good news is that I figured out a method that would work.
With a grid and a checkbox the below line needs to be added to the onchange
event:
onchange="checkboxname.selected=(eval(gridname.sel ectedItem.fieldname));"
*** note -Checkboxname, Gridname and Fieldname refers to the properties that
are set based on the actual names the user chose in their code when they add
these items.
I have no idea why the other method wouldn't work with my database (SQL Server
2000). Like I said the sample worked but the onchange code wouldn't work with
my particular grid connecting to my database, but the above does work.
ArtNirvana Guest



Reply With Quote

