[ic] [Error] Tag

Dave Barr dave.barr@cricinfo.com
Thu, 8 Feb 2001 10:20:27 +0000


>I have a checkout_profile on one page that checks for the name and 
>address and email address of a user. In the past if the user typed 
>in "blah" as a email address MV use to say something to the affect 
>of "is this really your email address?", on the page if they put in 
>"blah" it's considered legit and the page passes.
>
>I'm not use to the [error] tags, but is there a way to make it check 
>to see if the email address has a @ symbol and a .com or .net or 
>whatever?
>
>[set checkout_profile]
>First=required
>Last=required
>Address=required
>City=required
>Country=required
>State=required
>Zip=required
>email=required
>&fatal = yes
>&set=mv_email [value email]
>[/set]
>[error all=1 show_var=1 show_error=1 joiner='<br>']

Hi Ven,

I put profiles under:
_Path_To_Catalog_/etc/profiles.order

Along the lines of:
[snip]
__NAME__                            check_email
email=required
&fatal = yes
email=email
__END__
[/snip]

Otherwise heres another way of doing it directly on the page:

[snip]
[if value form_errors]
   <B><FONT COLOR=RED>[value form_errors]</FONT></B><P>
   [value name=form_errors set=""]
[/if]

[set check_email]
   [if type=value term=email op="!~" compare="/\w+@[-A-Za-z0-9.]+\.[A-Za-z]+/"]
     form_errors=We need a VALID eMail address for you.
     mv_nextpage=@@MV_PAGE@@
   [else]
     mv_nextpage=index
   [/else]
   [/if]
[/set]

<FORM ACTION="[process-target]" METHOD=POST>
<INPUT TYPE=hidden NAME=mv_todo VALUE=return>
<INPUT TYPE=hidden NAME=mv_check VALUE=check_email>
<INPUT TYPE=text NAME=email VALUE="[value email]" SIZE="20" MAXLENGTH="128">
<INPUT TYPE=SUBMIT VALUE="Submit">
</FORM>
[/snip]

It should take you to index.html if a successful regex is performed 
on the address otherwise an error in red will be shown...

HTH
"D"

-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dave Barr        eCommerce Technical Manager      CricInfo Ltd
www.cricinfo.com   dave.barr@cricinfo.com    Tel: 01249 700748
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~