[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

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
0
princehyderabad
Asked:
princehyderabad
  • 4
  • 3
1 Solution
 
fargoCommented:
Hi,

It's not that straight forward. If you are using struts, you can make use of indexed properties.

here is one example
http://www.developer.com/java/ejb/article.php/2233591

regards,
fargo
0
 
princehyderabadAuthor Commented:
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.

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21775732.html
This above link at bottom line explains how to get such values, excepts that its uses child-win to get in parent window.
0
 
fargoCommented:
Hi,

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

regards,
fargo
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
princehyderabadAuthor Commented:
Quite a big !!

It shows 4 diff. Zone(South, North, East, West) and each zone has alteast 10-12 checkbox (ie) area names.
0
 
fargoCommented:
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
0
 
princehyderabadAuthor Commented:
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
0
 
fargoCommented:
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now