Hi all.,
I have a multibox in my
JSP and I am displaying it through display tag.I have corresponding
String array property in my form.But the deselection of the checkboxes is not refelcting once the form is submitted...that means I have selected 2 of 5 checkboxes and submitted.And again I went to the same page deselected and submitted.But this time,the string array is not changing.Once the selection is made ,the deselection is not working.For this I have written javascript code. I am calling javascript function upon each selection and deselction of the checkbox.In that function if it is selected..I am putting the value as rownumber+1 ,if deselected I am putting an Empty string.After setting ,I have displayed the values through alerts.They are showing the correct values.But in the reset(),validate() methods old values are coming..means, once the selection is made that particular index is updated,but its not updating afterwards.
Here I am showing the code for
java script...
function setCheckBoxes(rowNum,formName)
{
mBox= document[formName]['mycheckbox'];
var checked=false;
if(mBox)
{
if(typeof mBox.length != 'undefined')
{
if(!mBox[rowNum].checked)
{
alert('you are not selected....');
document.getElementById("selectCheckBox["+rowNum+"]").value="";
alert("document.getElementById(selectCheckBox ["+rowNum+"]).value==="+document.getElementById("selectCheckBox ["+rowNum+"]").value);
}
else
{
document.getElementById("selectCheckBox ["+rowNum+"]").value=rowNum+1;
alert("document.getElementById(selectCheckBox["+rowNum+"]).value==="+document.getElementById("selectCheckBox["+rowNum+"]").value);
}
}
else
{
alert('mbox length is one.....');
if(!document.forms[formName]['mycheckbox'].checked)
{
selectCheckBox="";
alert('you are not selected....');
alert('the value...is'+selectCheckBox);
}
}
}
}
and in the JSP...
html:multibox property="selectCheckBox[${rowNo}]" value="${rowNo+1}"
title="click the check box to select" styleId="mycheckbox" on_click="setClientAccounts(${rowNo},'myForm')"
bean:write name="checklist_rowNum" /
/html:multibox
I have removed the
angular brackets...I hope you can understand...
Please tellme the soluiton for reflecting the checkbox values....