Skip to main content
Inspiring
May 5, 2008
Answered

CFGRID cfinput type=checkbox

  • May 5, 2008
  • 3 replies
  • 2963 views
Hello

Could some please help me with a CFGRID question? Is there a way to check/uncheck a checkbox in a CFINPUT type=checkbox based on the value returned in a CFGRID? For example:

<cfgrid name="questiongrid" query="questionQuery" format="flash">
<cfgridcolumn name="ID" header="QID" display="YES" width="50" />
<cfgridcolumn name="QUESTION" header="QUESTION" width="400" />
<cfgridcolumn name="TESTNUMBER" header="SET" width="50" />
</cfgrid>

(A bolean value is returned for the column mandatory from the query 'questionQuery' above)

<cfinput type="Checkbox" name="mandatory" label="Mandatory Question" enabled="yes" bind="{questiongrid.dataProvider[questiongrid.selectedIndex]['mandatory']}" />

Any ideas? I seen lots of examples of how to do inside the datagrid, but not in a CFFORM input.

Thanks for your help. JK
    This topic has been closed for replies.
    Correct answer Krogman
    Thank you for you reply ScareCrow.

    Yes, a flash form. Reviewing all the comments from the link to the post at AS Fusion you included, here is the code that worked (see note**)

    value="{gridName.selectedItem.columnName=='true'}"

    ** I think the problem I had is unrealated to CF/Flash. I was looking at the database field (which is bolean) in Microsoft SQL Server Management Studio, the values in the table are displayed as True/False, when IN FACT, it returns true/false. In Enterprise Manager, it's displayed as 1/0 -- Go figure, leave it to Microsoft.

    Thanks for your help :)

    3 replies

    Inspiring
    July 31, 2008
    An image of a checkbox?
    Inspiring
    July 31, 2008
    quote:

    An image of a checkbox?


    No, the example renderers the grid column to be an image.
    You need to replace the image tag in the example with a checkbox tag.

    Ken
    Inspiring
    July 29, 2008
    I was trying to get my html AJAX cfgrid grid column type="boolean" to display as a checkbox in the grid, but it only shows true and false. Also coming from SQL Server. In my detail view below the grid I also wanted to use checkboxes cfinput type="checkbox" bound to the grid and that does not seem to work, whereas again a text field will show true and false values. Is this a loose typing issue?
    Inspiring
    July 29, 2008
    You need to define your own grid renderer to display the checkbox.
    The following is an example of this. But in the example an image is used, just replace this with a checkbox.

    Example Link

    Ken
    Inspiring
    May 6, 2008
    I'm assuming this is a flash form ?

    You need to create an actionscript function that is activated by the onchange event of the grid.
    You would pass through the selected value and then either check or uncheck the checkbox.

    For some examples of this check out AS Fusion.

    Ken
    KrogmanAuthorCorrect answer
    Inspiring
    May 7, 2008
    Thank you for you reply ScareCrow.

    Yes, a flash form. Reviewing all the comments from the link to the post at AS Fusion you included, here is the code that worked (see note**)

    value="{gridName.selectedItem.columnName=='true'}"

    ** I think the problem I had is unrealated to CF/Flash. I was looking at the database field (which is bolean) in Microsoft SQL Server Management Studio, the values in the table are displayed as True/False, when IN FACT, it returns true/false. In Enterprise Manager, it's displayed as 1/0 -- Go figure, leave it to Microsoft.

    Thanks for your help :)