[ic] Validating fields in the form

Alma Nuker interchange-users@interchange.redhat.com
Tue Jan 29 01:14:01 2002


Hi guys;

I am trying to validate some form fields before I save them to DB.

I have someting like this:

[set mv_data_enable]1[/set]
<FORM ACTION .......>
<INPUT TYPE=hidden NAME="mv_form_profile" VALUE="evaluation_profile">
"all form details here"

then I have:

[if type=explicit compare="[error all=1 show_var=1 keep=1]"]
<font color=__CONTRAST__>There were errors in your last
submission.</FONT><br>
<ul>
<li>[error all=1 show_var=1 show_error=1 keep=1 joiner="<br><li>"]
</ul>
The areas that need correction are shown in <FONT
COLOR=__CONTRAST__>this color</FONT> below.</FONT>
[/if]


....................

Form details in here :

for example  for email address:

<TR> <TD>
[error name=email std_label="Email Address" required=1]</TD>
<TD><INPUT TYPE="TEXT" NAME="email" SIZE="52" MAXLENGTH="50"
VALUE="[value email]"></TD></TR>

also in profiles.order  I added following:

__NAME__      evaluation_profile

email=required
email=email
&setcheck=mv_email [value email]
__END__

Above works fine.

But what I really want is some more checking.

For example I want to make shore that address is not PO Box

I tried adding following into profiles.order:

[if value address1 =~ /p\.o\.\s*box\b/i]
No PO boxes allowed for address.
[/if]
address1=required

But it seems that is not working.

What I am doing wrong here.

I want to set up this so that when someone types in PO Box address that
"No  PO boxes allowed for address" message is displayed on screen.

Thanks a lot guys.

Alma