Link to home
Start Free TrialLog in
Avatar of princehyderabad
princehyderabad

asked on

CheckBox Mapping to DropDown

hi experts,

I have a form:
while (rs.next())
{
...
<input type=checkbox name="<%=r%>" value="<%=sss%>">
   <option value="<%=ALevel%>"><%=AName%></option>

}

Output:

[ ] CheckBox1     [dropdown: PM, CM, SM]
[ ] CheckBox2     [dropdown: PM, CM, SM]
[ ] CheckBox3     [dropdown: PM, CM, SM]


If user check the checbox and select from dropdown item. i wanna pass that relation or mapping to Processing page. (ie) Passing Which checkbox and its corresponding dropdown value.

Without dropdown I used my Processing code as:
..
String[] selected1 = request.getParameterValues("CheckBoxName");
if (selected1 != null && selected1.length != 0)
              {
                for (int i = 0; i < selected1.length; i++)
             {
                       //Update Query
                      ???? NOW HERE HOW TO GET DROPDOWN VALUE ALSO ????
             }          
              }



tHX,
PH
ASKER CERTIFIED SOLUTION
Avatar of fargo
fargo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of princehyderabad
princehyderabad

ASKER

thanks fargo, but I dont think its that complex. It has nothing to do with struts though I'm using struts action class for that form.

https://www.experts-exchange.com/questions/21775732/Passing-value-from-popup-window.html
This above link at bottom line explains how to get such values, excepts that its uses child-win to get in parent window.
Hi,

How big is your resultset? Is it dynamic size or you know how big it is?

regards,
fargo
Quite a big !!

It shows 4 diff. Zone(South, North, East, West) and each zone has alteast 10-12 checkbox (ie) area names.
Hi,

as i already said, if the number of input fields are finite (like 40 in your case) you can still give some fixed name and use them for the code. But it is not a good practise and i will still give you an opinion for indexed properties.

fargo
I think its better for go with index. Can U help me figure how to write java code to accept those indexed values. I dont know much abt index. I can do getparameter and getparametervalues stuff....sample code will help.

thx,
PH
the link i gave you at my first post is the best i have.
go thru it..try to implement it and let us know if you face any problems.

fargo