Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bjarne Fyrstenborg 1282 posts 3994 karma points MVP 8x c-trib
    Aug 13, 2011 @ 20:55
    Bjarne Fyrstenborg
    0

    Error message if regex doesn't match

    Hi..

    Is is possible to specify another error message if the regex doesn't match, e.g. "The input isn't a valid e-mail address"?

    Just like the ASP.NET RegularExpressionValidator , where the RequiredFieldValidator is used to check whether the field is empty or not.
    Here it just use the same error message for blank fields and wrong input.

    Bjarne

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 14, 2011 @ 14:39
    Dirk De Grave
    1

    I don't think so, the regex validator is used for all content, regardless of what type of content needs validation. So, no, but could provide some help info (can be set for each prop) for your users to make sure they enter valid data from the first time. Defo not a solution, but it would work.

     

    Cheers,

    /Dirk

  • Bjarne Fyrstenborg 1282 posts 3994 karma points MVP 8x c-trib
    Aug 14, 2011 @ 23:27
    Bjarne Fyrstenborg
    0

    Okay..
    the validator use the regex for the e-mail field.. and it might be using some other function to check if a field is blank?

    anyway it would be more appropriate to have a error message saying, that it isn't a valid e-mail address instead of "please enter your e-mail" when the user has written something into the field..

    Bjarne 

  • Jon Cuthbert 84 posts 173 karma points
    Sep 06, 2011 @ 16:56
    Jon Cuthbert
    0

    Bjarne, Dirk is correct. The error message is used for all invalid inputs. This might not be ideal for everyone but it is a simple solution. One suggestion would be to write an error message such as "Please enter a valid email."

    I will consider this enhancement for future releases.

  • Bjarne Fyrstenborg 1282 posts 3994 karma points MVP 8x c-trib
    Sep 06, 2011 @ 17:20
    Bjarne Fyrstenborg
    0

    Okay.. yes that could be a workaround temporary.

    I might be possible to do something like the RequiredFieldValidator and RegularExpressionValidator does, as they both generate some javascript to validate the input fields..

Please Sign in or register to post replies

Write your reply to:

Draft