so, now i'm trying to put in to a registration form
a simple checkbox
for the user to check to accept or leave unchecked to not accept (one of those terms/conditions/agreement things)
; and yes, it is required
for it to be check for the form to submit successfully.
i believe i've got everything working (it's a miracle!)
, but i'm wondering if/is it possible (& if so, then how) to keep the checkbox checked if
the user checked it, when the submit doesn't work due to a different validation error.
i've noticed the page seems to refresh & show the validation error(s), and all the other input fields keep the previously inputted data. so why in such a situation can't the checkbox remain checked?
:::FYI::: i'm not using "FormIt" - i am using "Login/Register" instead.
:::FYI::: here is my validation code without everything but the part for the checkbox...
:::FYI::: here is my html for the checkbox...
<input type="checkbox" name="agree" id="agree" checked="" value="Y" [[!+agree:FormItIsChecked=`Y`]] />
now, i don't know if that part after the value="Y"
is correct or not, but it's the only thing i found that seems to work for getting the requirement & error message to work right. i found it @ https://forums.modx.com/thread/44876/validation-errors-for-checkboxes-not-displaying
lastly, to be clear, the form is submitting when everything validates ok. i'm just trying to get the checkbox to remain checked, if the user checks it, after the form validates as invalid because of another field
. make sense?