Forums

Forums / Developing Portals / Error message to display when there are errors through validation

Error message to display when there are errors through validation

Thread is closed for posting
3 posts, 1 answered
  1. geoff.white
    geoff.white avatar
    31 posts
    Registered:
    27 Jan 2015
    20 Sep 2016
    Link to this post
    Is there a way to display an error message, such as 'There is an issue with your form. Please review.' near the submit button?

    Users need a prompt to check any errors as many report back 'it doesn't work' and haven't scrolled back up.

    I can see the messages for individual fields, but need an overall message to display if one or more fields don't validate.

    Surely this is a standard setting, but can't find any documentation or setting anywhere.

    Geoff
  2. Missing user
    Missing user avatar
    Answered
    20 Sep 2016 in reply to geoff.white
    Link to this post
    Hi Geoff,

    You can use JavaScript to identify if there is an error message or validation required message on the form when user clicks submit button. You can set the function below in the "OnClientClick" under advance property of the Submit button  and then, you can display message inside a content block that you can initially hide on the form at your desired location. This way you can show one message when there is an error or validation required for one or more fields.


    function verifyfields()
    {

    if($('.sfError').css('display') == 'inline')
    {
    alert ('There is an issue with your form. Please review');
    // or
    //  $('.CSSNameOfYourContentBlock').css('display','block');
    return false;
    }




    if($('.txtRequired').css('display') == 'inline')
    {
    alert ('There is an issue with your form. Please review');
    // or
    //  $('.CSSNameOfYourContentBlock').css('display','block');
    return false;
    }

    }
  3. geoff.white
    geoff.white avatar
    31 posts
    Registered:
    27 Jan 2015
    12 Dec 2016 in reply to Missing user
    Link to this post
    Syed,

    This is related to my other post where the drop downs for lookups go missing.

    If I add a validation function onClick and return false, all fields that don't validate have the error message come up twice for each field (e.g. Required field. Required field.) and any drop downs with lookups loose their information.

3 posts, 1 answered