Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Re: CFGRID & Checkbox

    ArtNirvana Guest

  2. Similar Questions and Discussions

    1. 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...
    2. 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.
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139