Support

Home Forums Event Espresso Premium Page scroll to error for mandatory field missing

Page scroll to error for mandatory field missing

Posted: December 1, 2016 at 9:31 am

Viewing 4 reply threads


modernearth

December 1, 2016 at 9:31 am

We are having a problem with the mandatory fields upon checkout.. When we click on ‘Proceed to Payment Options’ and we are missing a mandatory field, it doesn’t let the registration submit and we do get the error message. However it doesn’t scroll to the error message and our client has asked that it does.. So my question is either is there an easy way to make this happen? and if not is there a known way to run a function right after the submit function has fired, so I can add some jQuery to make it work?


Josh

  • Support Staff

December 1, 2016 at 10:30 am

You can add some jQuery to make it work, and the recommended way to add the jQuery is via the wp_add_inline_script() function in your theme’s functions.php file or from your own custom plugin.


modernearth

December 1, 2016 at 11:06 am

Hi Josh

How would I hook the jQuery function to run upon the submit button function being completed? As I currently have it, it only runs before the submit function so you have to double click the button in order for the page to move up to the required field missing.


Josh

  • Support Staff

December 1, 2016 at 11:45 am

Hi there,

You can try the validate event or the click event. A few examples follow:

Example 1:

function ee_test_validate_event_handler(){
    wp_add_inline_script( 
        'ee_form_section_validation',
        'jQuery( "#ee-spco-attendee_information-reg-step-form" ).validate({
            invalidHandler: function( event, validator ) {
              alert( "Handler for .validate() called." );
            }
        });'
    );
}
add_action( 'wp_enqueue_scripts', 'ee_test_validate_event_handler', 11 );

Example 2:

function ee_test_click_event_handler(){
    wp_add_inline_script( 
        'ee_form_section_validation',
        'jQuery( "#spco-go-to-step-finalize_registration-submit" ).click(function( event ) {
            alert( "Handler for .click() called." );
        });'
    );
}
add_action( 'wp_enqueue_scripts', 'ee_test_click_event_handler', 11 );


modernearth

December 1, 2016 at 12:49 pm

Thanks Josh, I will look into both and see if it works.

Viewing 4 reply threads

The support post ‘Page scroll to error for mandatory field missing’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso