Multi-Page Form: Enter key
-
I have noticed that the default behaviour for the enter key is somewhat undesireable: When pressing the enter key in a multi-page form I immediately receive the validation errors for all fields in the form.
Instead the form should continue to the next page.
I have fixed this locally with the following js snippet:jQuery(document).ready(function() { acf.addAction('af/form/setup', function( form ) { form.$el.keypress(function(event) { var keycode = event.keyCode || event.which; if ( keycode !== 13 ) return; event.preventDefault(); af.pages.nextPage( form ); }); }); });
Downside of this approach:
This breaks submitting the form on the last page with the enter key:
I couldn’t figure out how to get an updated form var to check the current page, it would be vary useful if there was a function to get the form var with updates properties in return.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multi-Page Form: Enter key’ is closed to new replies.