0

I have a form that contains a set number of checkboxes. It is expected that a user will want to select several items from the list. After the user selects items the form should autosubmit. It seems that with the following I can make the form autosubmit after each check:

<input type="checkbox" name="reg_check" checked="checked" onClick="this.form.submit()" />

However, since the users want to click several boxes, I don't want to have to update the page several times. How can I edit the code to allow the for to autosubmit after n seconds to allow time for the user to select other options as well?

1 Answer 1

0

Save a setTimeout call to a variable that will submit your form after a few seconds. Next when a click on your form inputs is detected, reset the variable to a new setTimeout. This will cause the first timeout to be cancelled. When the user stops clicking, the timer will run out, and the form will submit. You can see many examples here:

http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.