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

  • Profile Image
    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!

  • Profile Image
    Jim_R
    Answered on April 17, 2017 at 01: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

    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 

  • Profile Image
    RogerYelvington01
    Answered on April 17, 2017 at 01:29 PM

     

    reply :)

    https://youtu.be/IOkf24Vhcco

  • Profile Image
    Jim_R
    Answered on April 17, 2017 at 02: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.

  • Profile Image
    Roger 
    Answered on April 17, 2017 at 02:17 PM

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

     

  • Profile Image
    Jim_R
    Answered on April 17, 2017 at 02: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.

  • Profile Image
    RogerYelvington01
    Answered on April 17, 2017 at 02:46 PM

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

  • Profile Image
    Jim_R
    Answered on April 17, 2017 at 03: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:

    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.