Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Creating lists of input using Radio / Checkboxes


Message #1 by "ashima gupta" <ashima.gupta@c...> on Tue, 11 Mar 2003 16:24:40
A select field only lets them choose one value:

PsuedoCode:

iterator = 1;

for (each name in theList) {

"<select name=\"Boolean" + iterator + "\">";
	"<option value=\"AND\">";
	"<option value=\"OR\">";
	"<option value=\"NOT\">";
"</select>";

"<input type=\"text\" name=\"Name" + iterator + "\" value=\"" + name +
"\">";

iterator++;

}

Greg


-----Original Message-----
From: ashima gupta [mailto:ashima.gupta@c...]
Sent: Tuesday, March 11, 2003 4:25 PM
To: Servlets
Subject: [servlets] Creating lists of input using Radio / Checkboxes


I need to collect form data and send to a servlet. The user has to select
from a list of displayed elements, something like this...

AND OR NOT <Name>
@     @     @   Tim<value="Tim">
@     @     @   Rob<value="Rob">
@     @     @   Cathy<value="Cathy">
..... and so on.

So basically, I am specifying a query criteria here, choosing the names I
want in my AND, OR  and NOT conditions. Now @ could be either radio or
checkbox, but either is not giving me the full functionality that I want.
I need radio like ability so that if a user selects a name for one
condition , he cannot select it for another. So across a row, I should be
able to choose only one criteria. But in that case, I need to give the
same name to the radio buttons in one row. That means if I have a list of
300, I will have 300 different input elements and how do I collect all
elements of each condition on a list?

If each @ is a checkbox, then I can give all AND checkboxes the same name
and so on to collect all names for one condition in a list. but then how
do I add the functionality to make sure the user cannot select more than
one conditional operator for a name.

And in each case, if a user deselects the condition and chooses another
for the same name, it should get reflected in the list of values that I'm
collecting, probably in a hiddeen variable.
I thought about adding the element value to a list at onclick but then
how will I remove it if later user deselects the chosen option?  I could
use onSubmit function, if only I could make the checkboxes behave like
radio for each row while keeping the name same for a column (AND, OR or
NOT). I can't think of how to use onSubmit with radio cause I would have
to check for 300 different input elements!!!

Thanks in advance for your suggestions!

Ashima



  Return to Index