Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question getting checkbox Value checked or not

    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";
    else
    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

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    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:
    Code:
    eval("document.BAPP.e" + val + ".value")


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •