View Full Version : getting checkbox Value checked or not

02-20-2007, 12:17 PM
In my jsp page in a table writing a while loop under which i generated my checkboxes as following --- is my code for check box.

<input type="checkbox" class="vAVONInputCheckbox" name="C<%=list%>" value="OK" onClick="fnSetValue('C<%=list%>')" >

Then in JS i have written a function on click of check box

function fnSetValue(val)
if( (eval("document.BAPP."+val).checked) == true )
eval("document.BAPP."+val).value = "true";
eval("document.BAPP."+val).value = "false";

ok while loading it is alwayz unchecked so it is giving me false value only....
i need help i hav tried this for half day
i think am calling function at wrong place

plz help me its urgent

ThanQ :)

02-20-2007, 04:52 PM
If you want to use the eval for this you'll have to insert at least 1 letter before the val and the .value should be inside the eval too:

eval("document.BAPP.e" + val + ".value")