[ic] Validating form fields

Alexandra Birch interchange-users@interchange.redhat.com
Fri Jan 4 12:37:00 2002


Hi guys

I have a form for clients to enter their queries. 
This form needs to have some fields validated like the email field. 
I have seen two strategies for field validation in the foundation catalog:
 
1) using order profiles eg. any submit order form using profiles.order
2) calling a subroutine eg. new user account form calls sub new_account in UserDB.pm

Not feeling up to adding subroutines in the interchange libs I tried to add a new profile:

In myform.html:

              <form action="[process secure=1]" method="post" name="supportquery">
              <input type=hidden name=mv_todo value=submit>
              <input type=hidden name=mv_order_profile value=submit_query_profile>
              <input type=hidden name=mv_nextpage value="myform.html">
              <input type=hidden name=mv_session_id value="[data session id]">

		  [if type=explicit compare="[error all=1 show_var=1 keep=1]"]
              <font color=__CONTRAST__>There were errors in your last submission.</FONT>
              <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]

               [error name=name std_label="Name" required=1]
               <input type="text" name="email" size="25" maxlength="50">

               [error name=email std_label="E-mail address" required=1]
               <input type="text" name="title" size="40" maxlength="80">

In profiles.order:

		__NAME__ submit_query_profile


		&fatal=yes

		name=required Please enter your name
		email=required Please enter your email address
		email=email
		&setcheck=mv_email [value email]

		&final=no			#I dont want to submit any order

		__END__


Needless to say this didn't work. Could it work if I knew how to fix it? 
This is a pretty standard requirement - how do you guys validate your form fields?
Haven't been able to find much in docs and nothing in mailing lists.

Any pointers in the right direction will be welcome

Thanks 

Lexi

----------------------------------------------
Alexandra Birch
Trymedia Systems
965 10 77 71 
www.trymedia.com
----------------------------------------------