Hi,
I am trying to pass a bunch of checked checkboxes (Javascript array)
from page1 to the Java action class on subsequent web page (page2).
(on page 1 I have a bunch of DB rows with a checkbox,
need to iterate through pages page2 - e.g. allow user to update the fields
there)
On page1 I have a bunch of checkboxes with the same name v1
but different values (= DB rowId).
So I created a Javascript function:
function getCheckedValues(checkbox),
which returns an array of strings (value's of checked checkboxes).
On page1 I assign it to the hidden field.
<input type="hidden" name="v2"/>
in "onclick" event of page1 I execute JavaScript"
if (this.v1) v2.value=getCheckedValues(v1);
window.location.href="page2?v2=" + v2.value;
On page2 I also have:
<input type="hidden" name="v2"/>
In the Java class attached to page2 I try to do:
String [] ids = request.getParameterValues("v2");
It seems to create an array with 1 member which is blank.
I am getting the same result if I try to pass a
window.location.href="page2?v2=" + getCheckedValues(v1)
but at least I can see some comma separated id's in the IE URL.
Why is it not working ?
Is there a better solution ?
Please help !
Thank you in advance,
Oleg.
P.S.: I tried to google around and found this page:
http://www.irt.org/script/1433.htm
But I don't understand the second part of the code (looks like an incomplete
hack to me)
and need to receive that array from Java, not a Javascript.