Skip to main content
Inspiring
May 6, 2011
Question

Check all Checkboxes Using ColdFusion Form field binding

  • May 6, 2011
  • 1 reply
  • 3620 views

I have a group of check boxes and another single checkbox and when I click on that single check box all the checkboxes in the group should be checked. I need it without Javascript . I need to use Coldfusion's form field bind technique. Please help

    This topic has been closed for replies.

    1 reply

    talofer99
    Inspiring
    May 6, 2011

    Do you know that the binding of CF is done via JS ?

    It saves you the need to write a cross platform/browsers js code, but it can not be doen "without javascript" at all, unless you will create a flash form for example.

    balettanAuthor
    Inspiring
    May 6, 2011

    Thanks for the reply. I am looking for something below. This works fine when doing  the check all. I need a similar technique (form field binding) when uncheck the checkbox that should uncheck all the checked checkboxes. Please note that this works only when we give bindAttribute="checked"

    <cfform id="myForm1" format="html">

    check all:<cfinput type="checkbox" name="approved" id="approved" value="1" label="CheckyBox" />

    <cfinput type="text" name="textBoxName" bind="{myForm1:approved.checked@click}"/>

    <cfinput type="checkbox" id="bapproved1" bindAttribute="checked" name="bapproved" value="1" label="CheckyBox2" bind="{myForm1:approved.checked@click}"/>

    <cfinput type="checkbox" id="bapproved2" bindAttribute="checked" name="bapproved" value="1" label="CheckyBox3" bind="{myForm1:approved.checked@click}"/>

    <cfinput type="checkbox" id="bapproved3" bindAttribute="checked" name="bapproved" value="1" label="CheckyBox4" bind="{myForm1:approved.checked@click}"/>

    </cfform>

    talofer99
    Inspiring
    May 6, 2011

    I know you said no JS .... but I coudln't get it to work any other way ...

    but like that :

    <script type="text/javascript">
    function doitpro(flag)
    {
    return flag;
    }
    </script>

    <BR /><BR />
    <cfform name="myForm1">
    All <cfinput type="checkbox" name="controler" checked="false"><BR />
    <cfinput type="checkbox" name="optionscheckbox1" bindattribute="checked" bind="javascript:doitpro({myForm1:controler.checked@click})" value="11"> options = 11 <BR />
    <cfinput type="checkbox" name="optionscheckbox2" bindattribute="checked" bind="javascript:doitpro({myForm1:controler.checked@click})"  value="12"> options = 12 <BR />
    <cfinput type="checkbox" name="optionscheckbox3" bindattribute="checked" bind="javascript:doitpro({myForm1:controler.checked@click})" value="13"> options = 13 <BR />
    </cfform>

    try it