Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

retrieving checkbox value as Y and N when it is checked or unchecked

843840Apr 3 2009 — edited Apr 5 2009
I have a checkbox and on checking the checkbox , value 'Y' should go to the database. On unchecking the checkbox, value 'N' should go to the database.

Initially , when the db value is Y, it displays the checkbox as checked. but when I uncheck it, the value of the heckbox becomed Null instead of 'N'

Below is the checkbox definition and the javascruipt it calls on onclick event.

<input name="checkname" type="checkbox" <c:if test= "${sData.flag == 'Y' }"> CHECKED </c:if> value="Y" onclick = "check(this)" ></center>

function check(checkbox)
{
var yOrN = (this.checked)?"Y":"N";
checkbox.value =yOrN

if (yOrN == "Y")
checkbox.checked = true;

if (yOrN == "N")
checkbox.checked = false;

}

This is bit urgent to me.. . Please help..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2009
Added on Apr 3 2009
5 comments
1,506 views