amiem Posted March 26, 2021 Share Posted March 26, 2021 Hi there! Im wondering if anyone could help me!!? I am trying to find a way to stop the form submitting when you press enter / return when filling out the text boxes? Any help much appreciated! Thanks! Beyondspace 1 Link to comment
Beyondspace Posted March 30, 2021 Share Posted March 30, 2021 On 3/26/2021 at 11:38 PM, amiem said: Hi there! Im wondering if anyone could help me!!? I am trying to find a way to stop the form submitting when you press enter / return when filling out the text boxes? Any help much appreciated! Thanks! Simple jquery can help <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function() { $('.sqs-block-form').on('keypress keydown keyup', function(e){ if(e.keyCode == 13) { e.preventDefault(); } }); }); </script> tuanphan and creedon 1 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
tuanphan Posted March 31, 2021 Share Posted March 31, 2021 @SolveigTraeet You can try above code for your case. if it doesn't work, replace sqs-block-form class with search class Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
CoralMind Posted January 10, 2022 Share Posted January 10, 2022 @tuanphan @bangank36 I'm hoping you can further help me with the same issue. In my Squarespace 7.1 website form, I want the enter / return button to simply act as a tab keystroke to allow my audience to put in a list of names into a text field without prematurely submitting the form. I used the code you suggested above but it resulted in fully disabling the enter/return button. Do you have any suggestions on how to modify the code? Thanks! Link to comment
RubenGeuzinge Posted February 28 Share Posted February 28 I want this for a search-entry field. I only want people to select from the preview results and not to go to the search result page. The enter button is the trigger for the search result page. I think this would be a good solution, but I seem nog to get this code to work. Could you help me out? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment