[ic] form profiles
Peter
peter at pajamian.dhs.org
Fri Mar 6 21:44:43 UTC 2015
On 03/07/2015 07:49 AM, Grant wrote:
>> zip=regex ![^A-Za-z0-9 -] "Postal code can only contain letters,
>> numbers, spaces, and hyphens."
>
>
> Hi Peter, can that go in the mv_form_profile? I tried it there but I get:
>
> Sorry, there was an error in processing this form action. Please
> report the error or try again later. (Unmatched [ in regex; marked by
> <-- HERE in m/[ <-- HERE ^A-Za-z0-9/ at (eval 205) line 15. )
Try quoting the regex:
zip=regex "![^A-Za-z0-9 -]" "Postal code can only contain letters,
numbers, spaces, and hyphens."
> Also I use email_only in my mv_form_profile but it lets spaces in the
> email address go through. Where is email_only defined or is there a
> better definition to use?
Space is actually a legal character in the local part of an email
address as long as it's quoted and while I would recommend that you
never create an email address with a space (or other funny characters)
in it, you should accept one to avoid rejecting legitimate addresses.
That said...
email_only is defined in code/OrderCheck along with most of the profile
checks. You can grab the regex from in there, modify it slightly and
use it in a regex check instead. The space is octal 040, so you would
do the following to exclude space from the regex:
email=regex "^[\041-\077\101-\176]+\@[-A-Za-z0-9.]+\.[A-Za-z]+$/" "not
an email address"
Peter
More information about the interchange-users
mailing list