The nicest way would be to use a JavaScript clientside script on the form page. I think you can find a good one @ javascript.internet.com If you don't want to use Javascript, you can use the regular expression found from the javascript and use it in a python method of module. ----- Original Message ----- From: Stacy Formby <sformby@scicomp.com> To: <zope@zope.org> Sent: Monday, July 17, 2000 7:57 PM Subject: [Zope] How to require an @ symbol in email form field??
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>
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )