I am having a small problem with getParameterValues function and my algoritm. Before I will explain how is my data table showed:
| value1 | value2 | TextArea | CheckBox |
Then when I check any checkbox and press submit it call other servlet and read the parameters :
String[] checkboxes= request.getParameterValues("checkbox");
String[] textareas= request.getParameterValues("textarea");
for (int j = 0; j < checkboxes.length; j++) {
id = checkboxes[j];
variable = observacion[j];
boolean i = userdao.modificaSolicitud(id, variable); // this is a update sql method
}
The problem is that getParameterValues readthe checkbox checked (that is fine) but read all the textareas input (empty or not). Therefore I have 2 arrays diferents length.
| values | textarea1 | checkbox1 |
| values | textarea2 | checkbox2 |
| values | textarea3 | checkbox3 |
If check the checkboxes 1 and 3 and change the text in the textareas 1 and 3 respectively then when I execute the update it textareas values appear in the wrong place, is to say, textarea3 value will appear in textarea2.
I trying to relation both elements (checkbox and textarea). I can not to use the value property in the textarea for obvious reasons, also I can not to use the ID because getParameterValues not use it, then What I can to do?
Muchas Gracis for All.