Wednesday, 15 May 2013

How to access the check box values in JSP -



How to access the check box values in JSP -

i new jsp , have next issue:

i have values of checkboxes checked , create utilize of these values in java

in approve.jsp have function called validateapprove() called when button clicked.

function validateapprove() { var cc= document.getelementsbyname('imagecheckbox'); var j=0; var values = new array(); (var = 0; < cc.length; i++) { if(cc[i].checked == true) { values[j]== cc[i].value; j++; } } if (j==0) { alert("please check atleast 1 item"); } else { alert("are sure? want approve " + j + " item(s)"); } }

the error is: referenceerror: array not defined

why error thrown? can utilize array in java next way:

string vals[] = request.getparametervalues("values");

mistake in

var values = new array();

should be

var values = new array();

a not a in array declaration.

see also array in javascript

jsp

No comments:

Post a Comment