hi

pls...any one replay me

i wanted to update status of shoping cart item(status using dropdownlist for selecting option). And this value should depend on selected checkbox value.

That is i wanted to select required item and for that item status should be updated by passing this itemid and status of selected item using jsp.


pls..any one help me with this..

both checkbox and dropdownlist is comming under one "For Loop" and under one "Form".

pls...help..me

thaks..

Your post is rather confusing. If I get it right:
You will have a list of <select> tags and checkbox tags. Each "select" will be connected with each "checkbox". When the user submits you will have to get the value of ONE "select" box and that select box would be the one that corresponds to the checkbox checked?

// int i is the index of the for loop
// length is the length of the for loop
for (int i=0;i<length;i++) {
  <select name="select_<%= i%>">
  ...
  </select>
  <input type="checkbox" name="check_<%= i%>" />
}
<input type="hidden" name="length" value="<%= length%>" />

After you submit have a loop that takes the values of the checkbox. When the one checked is found use the index to get the select:

String len = request.getParameter("length");
int length = 0;
if (len!=null) {
length = Integer.parseInt(len);
}
String valueSelected = "";
for (int i=0;i<length;i++) {
   if ("on".equals( request.getParameter("check_"+i) )) {
       valueSelected = request.getParameter("select_"+i);
       break;
   }
}

Notice this trick:

<select name="select_<%= i%>">
<input type="checkbox" name="check_<%= i%>" />

request.getParameter("select_"+i)
request.getParameter("check_"+i)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.