I agree ....
this is my solution. thnx to josh canfield who give me the idea.
Instead of using document.getElementsByTagName("INPUT") then check whether
is checkbox or not, I prefer to use this method. the same idea as josh
canfield but I try to get the form element as the root of iteration, not the
input. it's to avoid if there is more than one form in one page.
IHMO(cos I doesn't have enough experiance to make an opinion which one is
better). what I mean with a simple solution is we try to do this in client
side. and we don't have to use others component.
<script type="text/javascript" language="JavaScript">
function selectAllCheckboxes(select){
<!-- //
var form = document.getElementById("newspaperForm");
var checkAll = document.getElementById("checkAllRemove");
if(checkAll.checked){
for (var i=0;i<form.length;i++)
{
if (form.elements[i].type == "checkbox") {
form.elements[i].checked = true;
}
}
}else{
for (var i=0;i<form.length;i++)
{
if (form.elements[i].type == "checkbox") {
form.elements[i].checked = false;
}
}
}
// -->
}
</script>
<form t:type="form" t:id="newspaperForm">
<input t:type="checkbox" t:value="subscribeYahoo"/>Yahoo
<input t:type="checkbox" t:value="subscribeGoogle"/>Google
<input type="checkbox" id="checkAllRemove"
onClick="selectAllCheckboxes();"/>Check All
<input type="submit" value="Submit"/><br/>
Result : <b>${value}</b>
</form>
I am sorry, I am not very fluently in english. ^^,
regards,
dwi ardi irawan
On Wed, Jan 19, 2011 at 12:16 PM, Taha Hafeez <[email protected]>wrote:
> Yes, this is an option as are others and these can be used AFAIK. The
> thread
> there shows a way to use it even if javascript is disabled
>
> regards
> Taha
>
--