Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pre-check checkboxes via Post

Status
Not open for further replies.

upplepop

IS-IT--Management
Jun 1, 2002
173
US
This is a pretty simple request, but I'm new to Javascript so thanks upfront for your patience.

I'm trying to pre-populate some check boxes based on values passed to a JSP page through either a POST or GET call.

So if my post string is:

It would pre-check the "dog" and "blue" answer values my form.jsp page:
Code:
My favorite animal is:<br />
<input type="checkbox" name="animal" value="dog" />Dog<br />
<input type="checkbox" name="animal" value="cat" />Cat<br />
<input type="checkbox" name="animal" value="horse" />Horse<br />

My favorite color is:<br />
<input type="checkbox" name="color" value="blue" />Blue<br />
<input type="checkbox" name="color" value="red" />Red<br />
<input type="checkbox" name="color" value="green" />Green<br />
Obviously, my real-world application is more complicated than this; but I can figure it out based on the answer to this example.
 
JSP while somewhat similar to Javascript is not Javascript. As such the methods to do this in JSP would be different.

You might be better served to ask this in the actual forum695.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top