You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Claire Suttle <cl...@geoviz.com> on 2004/01/19 23:12:07 UTC

accessing dynamic radio and check boxes

Hi,

I'm using dyna action forms on a couple of my pages, and I'd like to know how to access the checkboxes and radio buttons via javascript. I know I need document.forms[0].something...but I don't know what I need next.

What I want to be able to do is set the first radio button as selected by default, and allow one clicking on one checkbox to set all check boxes as selected.

If someone could tell me what I need to use to be able to access these objects, that'd be great!

Thanks,
Claire

RE: accessing dynamic radio and check boxes

Posted by Leticia Golubov <lg...@micromuse.com>.
Hi, you probably worked out how to do this already, but if you haven't here
is how I did it:

to check check boxes with one click, use this Javascript function, or
similar:

function CheckAll( form_number )
{
	for( n=0; document.forms[form_number].elements[n] != null; n++)
	{
		if( document.forms[form_number].elements[n].type == "checkbox" )
		{
			document.forms[form_number].elements[n].checked = true;
		}
	}
}


HTH

Leticia

-----Original Message-----
From: Claire Suttle [mailto:claire@geoviz.com]
Sent: 19 January 2004 22:12
To: struts-user@jakarta.apache.org
Subject: accessing dynamic radio and check boxes


Hi,

I'm using dyna action forms on a couple of my pages, and I'd like to know
how to access the checkboxes and radio buttons via javascript. I know I need
document.forms[0].something...but I don't know what I need next.

What I want to be able to do is set the first radio button as selected by
default, and allow one clicking on one checkbox to set all check boxes as
selected.

If someone could tell me what I need to use to be able to access these
objects, that'd be great!

Thanks,
Claire


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org