How can I show Field Validation errors only upon hitting the submit button and not when the field loses focus?

  • RogerYelvington01
    Asked on April 17, 2017 at 12:41 PM

    I'd like to show the "this field required" message for questions only if the question has not been completed.

    How do I do this?


    Thank you!

  • Support_Management Jotform Support
    Replied on April 17, 2017 at 1:24 PM

    Hello 😊 I checked your form and it already works the way you described it - the "this field required" message for questions only shows up if the question has not been completed

    How can I show Field Validation errors only upon hitting the submit button and not when the field loses focus? Image 1 Screenshot 20

    Or are you perhaps hoping to remove the field validation onblur, meaning when the user leaves the focus on one field then moved to another. If so, I'm afraid that's not possible. Field Validation happens on 2 instances:

    1. When a field loses focus (onblur)

    2. When the submit (in your case, the NEXT) button is hit

    This is just the default behavior of field validation and something that can never be overridden. If it's imperative to go in this direction, the only possible workaround is to do this outside JotForm.

    What I mean is, you grab the Full Source code of the form, then implement your own logic for field validation upon your (or your developer's) discretion.

    Related guide: How-to-get-the-Full-Source-Code-of-your-Form 

  • RogerYelvington01
    Replied on April 17, 2017 at 1:29 PM

     

    reply :)

  • Support_Management Jotform Support
    Replied on April 17, 2017 at 2:13 PM

    Thanks for the video - What you explained appears to be covered on the latter part of my reply (the onblur field validation). To quote what I posted:

    Or are you perhaps hoping to remove the field validation onblur, meaning when the user leaves the focus on one field then moved to another. If so, I'm afraid that's not possible. Field Validation happens on 2 instances:

    1. When a field loses focus (onblur)

    2. When the submit (in your case, the NEXT) button is hit

    This is just the default behavior of field validation and something that can never be overridden. If it's imperative to go in this direction, the only possible workaround is to do this outside JotForm.

    What I mean is, you grab the Full Source code of the form, then implement your own logic for field validation upon your (or your developer's) discretion.

    Related guide: How-to-get-the-Full-Source-Code-of-your-Form 

    In case you need more help, don't hesitate to ask.

  • Roger
    Replied on April 17, 2017 at 2:17 PM

    Oh, I thought it would be possible to only show the field errors at the point the submit button is hit.

     

  • Support_Management Jotform Support
    Replied on April 17, 2017 at 2:40 PM

    Sadly, it's not possible, Roger. The errors will always show up either once the field loses focus or once the Submit button is clicked.

  • RogerYelvington01
    Replied on April 17, 2017 at 2:46 PM

    as a work around - what would the code be to hide the error message labels?

  • Support_Management Jotform Support
    Replied on April 17, 2017 at 3:11 PM

    Removing the "This field is required." error message can be done with CSS. Add the following codes to remove them:

    .form-line-error {

      background: none transparent;

    }

     

    .form-error-message, .form-required {

      display: none !important;

    }

     

    .form-validation-error {

      -moz-box-shadow:none;

      -webkit-box-shadow:none;

      box-shadow:none;

    }

    Result:

    How can I show Field Validation errors only upon hitting the submit button and not when the field loses focus? Image 1 Screenshot 20

    I'm seeing you already have a handful of Custom CSS on your form so I'm sure you know where to place these 😊 Give it a whirl and let us know if you'd need more help.