You are viewing limited content. For full access, please sign in.

Question

Question

Field validation in input data in Forms

asked on April 7, 2015

I know that in the Laserfiche Administration Console, we can specify constraints as to how data can (or can't) be entered.  Is it possible to do the same thing in Laserfiche Forms, where an error will be raised if incorrect data is entered?  For example, it seems like a number of people have been entering (area code) 555-5555 to get around entering something valid, and this seems to be happening way more often than we'd like.  

Could we have something in Forms, for the phone number field, that could restrict values like this?  I think this could really come in handy for people trying to sidestep entering something valid.

Thanks to anyone who can help!

Marty Gaffney - Network Technician

Town of Okotoks

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on April 9, 2015

There is a way to do it. When you are specifying your regular expression, you would need to use ranges that are acceptable for each value and not just allow any digit. Here is a great website that teaches the basics of regular expressions: http://regexone.com/

0 0

Replies

replied on April 7, 2015

Hi Marty,

You can use regular expressions in single line fields. See this page for more information.

Regards

1 0
replied on April 8, 2015

That's good to know, I didn't realize you could apply validation that way.  

One thing, though - I know you can match a phrase by specifying the string of text, but is there a way to say "anytime this phrase is entered, the user cannot continue".  In this case, I find users are constantly entering 555-5555 for a phone number, but I don't want to use [^5][^5][^5]-[^5][^5][^5][^5], as this would eliminate a "5" typed anywhere.  I tried something like [^555-5555], but this didn't work.

Is there something that might accomplish something like this?  Thanks again!

0 0
APPROVED ANSWER SELECTED ANSWER
replied on April 9, 2015

There is a way to do it. When you are specifying your regular expression, you would need to use ranges that are acceptable for each value and not just allow any digit. Here is a great website that teaches the basics of regular expressions: http://regexone.com/

0 0
replied on April 9, 2015

Oh sweet - adding that one to my Favorites.  Thanks!

0 0
replied on April 9, 2015

Hi Marty,

Because you have the additional constraint of the phone number format (\d{3}-\d{4}), I actually don't believe this is possible with regular expressions. Regular expressions focus on allowing or disallowing individual characters, whereas your situation involves a multi-character exception. 

Instead, I would go the JavaScript route. You can throw a "change" event on the field to check if the input value is 555-5555. If it is, you can set a message to pop up, saying that it's an invalid input, and then wipe the value from the field.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.