Context: I think that filling out a form in a paper with a pen brings the person to pay more attention to what it writes and I wonder if there is a way to bring that to a html form.
Expected Behaviour: The person clicks on a checkbox and it stays like that unless the person reloads the page, it cannot be "unclicked", or a person writes a settence in a text field and, after it presses enter (or tab) the field can’t be edited.
Doesn’t have to behave exactly like that, any suggestion close to it will be helpful. It can be in HTML, Js, Python (for Django) or whatever, just wondered if there is a "simple" way or it would be a separate project all throughout.
Tried searching on google but didn’t find anything close to that.
2
Answers
You can use the focusout event handler to do what you want.
And as said by Abdul Aziz Barkat in the comments, you need to enable them before sending the form, elsewhere, they will not be included in the request.
You can also use the readOnly attribute instead of the disabled to avoid this extra step, but the checkbox will not work by itself with this solution.
If you have multiple forms with inputs or types of input you can use the queryselectorall to check for inputs in a form; based on attributes etc.
You can then do this:
This allows the user to select an other input with mouse, tab or enter if the input is filled in.