Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Sorry to bother you. Actually in my code it doesn't require any javascript. My code works in CHECK ALL scenario
I need your help on how to do UNCHECK so that all the checked boxes are got unchecked. So in a nut shell I would say The code below works fine for Check all. Can you make some changes in the below code so that on click of the checked box (i.e on uncheck) all the checked boxes got unchecked.
Your code also works fine only in Check All situation. You can either make changes in your code or the below my code to implement uncheck ALL
<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>
Copy link to clipboard
Copied
I was not clear ...
Yes your code do half the work ... I couldn't find and other way to do it except using that samll peice of JS code.
If you do find one that will work only on BIND let me know
Copy link to clipboard
Copied
Given that the bind method you want to use is just another form of javascript, and that what you are trying to accomplish is incredibly simple with normal javascript, why are you spending so much time and effort making easy things difficult?
Copy link to clipboard
Copied
The below JS works fine
function doBind(flag)
{
if(flag=='false')
return '';
else
return flag
}
<cfform id ="frmReclassAdj">
<input type="checkBox" value="chkAllStir" id="stir_all_checkbox" name="stir_all_checkbox">
<cfinput type="checkBox" name="chkAdjSelector" bindattribute="checked" bind="javascript:doBind({frmReclassAdj:stir_all_checkbox.checked@click})" value="" id="checkBoxID_#r_no#">
</cfform>
This works fine when check All and Uncheck All
Message was edited by: balettan