R
RHPT
I have a checkbox that I dynamically check (via JavaScript) when the
user initiates an action on the page. I want to prevent the user from
unchecking the box if that action has been initiated and the user has
not canceled it. Essentially, I want to dynamically create an
onclick="return false;" event on the checkbox, but only when the user
initiates this particular action.
My attempts at doing this have not worked out. I tried checking to see
if the action occurred, then checking the box via javascript. However,
I find this does not work . Does anyone know how I can achieve this?
Do I even make any sense at all? I have provided some pseudo code
below.
function checkForCheck()
{
if (this_condition == true)
document.someForm.someCheckbox.checked = true;
}
<form name="someForm">
<input type="checkbox" name="someCheckbox" value="1"
onclick="checkForCheck();">
</form>
Thank you!
user initiates an action on the page. I want to prevent the user from
unchecking the box if that action has been initiated and the user has
not canceled it. Essentially, I want to dynamically create an
onclick="return false;" event on the checkbox, but only when the user
initiates this particular action.
My attempts at doing this have not worked out. I tried checking to see
if the action occurred, then checking the box via javascript. However,
I find this does not work . Does anyone know how I can achieve this?
Do I even make any sense at all? I have provided some pseudo code
below.
function checkForCheck()
{
if (this_condition == true)
document.someForm.someCheckbox.checked = true;
}
<form name="someForm">
<input type="checkbox" name="someCheckbox" value="1"
onclick="checkForCheck();">
</form>
Thank you!