ab2013 Posted April 29, 2014 Report Share Posted April 29, 2014 I am setting up an update form which can be used in two different ways, by hiding or displaying fields. The way the form detects which of the two sets of fields to display is by a checkbox field. The form also sets this checkbox field so that the next time the form is used the fields that were hidden become visible and the visible ones become hidden. The problem is that on loading the form the checkbox value is always read as 'Y'. I try setting this to 'N' or 'No' in the javascript but it doesn't make any difference even when the form is updated and then re-used. I am using chrome and windows XP Quote Link to comment Share on other sites More sharing options...
Jan Posted April 30, 2014 Report Share Posted April 30, 2014 Hello ab2013, If I understand correctly, it is better to use the Checked property. Example, function is_checked_and_change() { var is_checked = document.getElementById("id").checked; if (is_checked) { document.getElementById("id").checked=false; } else { document.getElementById("id").checked=true; } } The function checks if the checkbox is checked. If the checkbox is checked, the function unchecks it and vice versa. Quote Link to comment Share on other sites More sharing options...
Ba2sai Posted April 5, 2017 Report Share Posted April 5, 2017 You can use this to put a check on a virtual checkbox on window.load: <script> window.onload = function(){ document.getElementById('cbParamVirtual1').checked=true; } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.