Home › Forums › Quform WordPress › Disable Return/Enter button as way to submit form?
- This topic has 5 replies, 3 voices, and was last updated 11 years, 3 months ago by
brettlondon.
- AuthorPosts
- January 30, 2014 at 12:27 am #8512
brettlondon
ParticipantIs there a way to disable submitting the form by simply pressing the Return/Enter button on the keyboard?
I ask because if in the middle of filling out the form if someone hits the Enter button by mistake, the form is either sent half filled out and then cleared of all data, or errors pop up and it gets messy.
So is there a way to make the form only submittable by clicking the Send button?
Thanks!
February 2, 2014 at 6:56 am #8538dreoin
ParticipantWhile I don’t have/know the solution, I have a work around.
We have an issue with people using the “enter” key when typing their name in a form on a software keyboard on an ipad. We solved the issue by making another field required so that they would get an error rather than accidentally submitting the form. So field A would ask that the person to type in a text field and field B would be a required question which would prevent the “enter” key being used in field A from submitting the form.
Eoin
February 2, 2014 at 11:55 pm #8543josef777
ParticipantTry the following code :
<script type="text/javascript">function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}document.onkeypress = stopRKey;
</script>
February 3, 2014 at 4:08 am #8547dreoin
ParticipantJosef,
Would you insert the custom code in the form somewhere or would this be a plug-in wide setting?
EoinFebruary 3, 2014 at 1:01 pm #8548josef777
ParticipantEoin
go to edit your form and Add html field at the end of your form and put the code in itYou can test it Here
February 4, 2014 at 12:39 am #8561brettlondon
ParticipantThat works perfectly!
Thanks so much for all the assistance on this!
- AuthorPosts
- You must be logged in to reply to this topic.