• Hello,

    When a user registers on our site using Ultimate Member plugin and the form doesn’t validate, it reloads the page with an error message right down the bottom, where users don’t see it, and they assume the form submitted correctly. This seems like a crazy choice! Is there a way to move the error message to the TOP of the page, so it’s more obvious when the form submit fails?? Or scroll the page to the bottom when it loads?
    Please help me to sort this, I want like, is it possible to add single validation message to display on the top of the page if there is validation error in any fields. like “Error while submitting the form” on top, keeping the other validation messages.

    Thanks in advance
    Prasad D.

    • This topic was modified 5 years, 10 months ago by prasadd1989.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter prasadd1989

    (@prasadd1989)

    Hello,

    Please help me in this, I am looking for solution but not getting how to do it,

    any response?
    your help will be appreciated.

    Thanks
    Prasad D

    In your custom template file use this code to check if there is any error and then display your message.

    if ( UM()->form()->count_errors() > 0 ) {
    					$errors = UM()->form()->errors;
    					// hook for other plugins to display error
    					$error_keys = array_keys( $errors );
    				}
    				if ( isset( $args['custom_fields'] ) ) {
    					$custom_fields = $args['custom_fields'];
    				}
    
    				if ( ! empty( $error_keys ) && ! empty( $custom_fields ) ) {
    					/*foreach ( $error_keys as $error ) {
    						print_r($error);
    					}*/
    					echo "";
    				}
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Move form validation error messages to top of page’ is closed to new replies.