[Zope] How to require an @ symbol in email form field??

Stacy Formby sformby@scicomp.com
Mon, 17 Jul 2000 13:57:14 -0500


Hello,

I am new to Zope; since our webmaster left I'm trying to make small
changes to the website. We have a standard registration form that
collects information from users (first name, last name, email, company
name, etc.) All of the fields are required, except address 2, address3.

Great. fine. If the user doesn't fill out a field, they get an alert.
But they can fill each field out with gibberish--as long as there is a
character in the input, we accept it.

Is there a way to require at least an "@" sign in the email field? The
powers that be think this would be useful.

Here's the form processing code as it stands today. Any help is
appreciated.

Sformby

<!-- Check whether any fields are missing. --> <dtml-in required>
<dtml-comment>
The length of the following expr is due to the fact that some types of
form elements
(e.g. text) always create a var, while others (e.g. radio) don't.
</dtml-comment>

<dtml-unless expr="REQUEST.form.has_key(_['sequence-key']) and
REQUEST.form[_['sequence-key']]">
<dtml-call request.set(missing_fields1)"> </dtml-unless> </dtml-in>

 <!-- If fields are missing, inform the user. -->
<dtml-if request.has_key(missing_fields')"> The following input fields
are required
and have not been filled out: <!-- List missing fields. -->
<ul>
  <dtml-in required> <dtml-unless
expr="REQUEST.form.has_key(_['sequence-key']) and
REQUEST.form[_['sequence-key']]">
  <li><dtml-var sequence-item>
  </dtml-unless> </dtml-in>
</ul>
Please click on your browser's "Back" button to update your information,
or <a href="registration.html">click
here</a> to start over. <dtml-else>