Form submits when customer hits enter to go to next question

Highlighted
New Contributor

I have had a customer who pressed enter on the form to go to the next question but the form instead submitted when they hadn't finished.  Not all questions on the form are mandatory.  What can I do to fix this so it doesn't occur again?

Thanks

Reply
0 Upvotes
10 Replies 10
Top Contributor | Gold Partner

Hi, 

 

To ensure form fileds are maditory, I have added some instructions below:

 

1) Locate to your form and click 'edit'

2) Click on the form field 

3) On the left hand side, scroll down and you will see a checkbox labelled "Make this field required"

4) Repeat for any fields that are required

5) Click publish

 

Please let me know if this doesnt work. 

 


Thanks,
Elysha Shave

New Contributor

Hi Elysha

 
Thank you for replying.  Unfortunately it is not the mandatory field that is the issue.
 
On my form I have some fields that are mandatory and others that aren't and I need to keep it that way as I have dependencies. 
When a customer hits enter to go to the next line (some do enter instead of tab) the survey gets submitted even though they haven't finished the form.
 
I need to change the configuration of the submit button so it is only submitted if the click on it rather than if the customer hits enter.
 
Can you help me with this?
 
Thanks for your time and trouble
Reply
0 Upvotes
Top Contributor | Gold Partner

Hi, 

 

I will have a chat with our developers to check whether this is possible, if so, we can make this change for you to save you time and effort. 

 

I will respond once I have heard back and then we can discuss next steps. 

 


Thanks,

Elysha Shave

Reply
0 Upvotes
Top Contributor | Gold Partner

Hi, 

 

Our developers have reached out and have said that it is possible to complete this but would be a cost with a 1 day turn around. If you would like to proceed and have us fix this for you, please let me know and we can take things further. 

 


Thanks,
Elysha Shave

Reply
0 Upvotes
New Contributor

Hi Eylsa

 

Thanks so much for your email.  Celin from Hubspot has already fixed this and gave me the java script code.  

I appreciate your efforts and I am sorry I didn't close this earlier.  Apologies I'm new at this.

 

Thanks and regards

 

Michelle

Reply
0 Upvotes
Occasional Contributor

Hi Michelle,

I'm experiencing the same problem. Could you please give me the java script code that fixes this issue? 

 

Best regards,

Marieke Westerterp

Reply
0 Upvotes
New Contributor

Hi 

Celin helped me with this - here is her email

 

Thanks for your email! Great news here! I found a javascript online which when added to the page, will prevent the submission of forms when hitting the enter button externally in this documentation here, in which the code is below

 

<script>
  $(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
  </script>

 

You may proceed to implement this. By the following

  • If you are intending to add them only on specific pages, apply the code as per the screenshot attached
  • If you are intending to add them across all pages, you can apply the code in your website domain settings here (under the head/footer HTML)

Hope the above clarifies on this! Please do not hesitate to let me know if you have any questions on the above and I'll be happy to help!

 

Best Regards, Celin

Reply
0 Upvotes
Occasional Contributor

Hi Mafnz,

Thanks for replying! This helps. 

Only when I hit enter in a textarea the cursor doesn't go to the next line. Do you experience the same behaviour?

 

Best regards,

Marieke Westerterp

Reply
0 Upvotes
New Contributor

Hi Marieke

Unfortunately I haven't noticed this!

Reply
0 Upvotes
Occasional Contributor

Oke, Thanks for your reply.

Marieke

Reply
0 Upvotes