> Is there a way to require at least an "@" sign in the email field? The
> powers that be think this would be useful.
<dtml-unless "'@' in REQUEST.email">... complain here ...</dtml-

> Here's the form processing code as it stands today. Any help is
> appreciated.
Use javascript to check that all required fields are present before 
the form is actually submitted. Here is some of the code I use:

<SCRIPT Language="Javascript1.2" src="jsvalidate"></SCRIPT>
<form action="..." method="post" onSubmit="return 

where jsvalidate is a DTMLDocument that may be found at 

Also, consider using the :default modifier on fields to force them to 
have a value. For example, if you put
<input type="hidden" name="field1:default" value="whatever">

then if the field is left empty, or in the case of a radio button not 
selected, the default value will be used.

> <!-- Check whether any fields are missing. -->
... code snipped ...

Here's a somewhat shorter, albeit more obscure, way to check 
whether all the fields you want are in the REQUEST form:

<dtml-let required="[ 'name', 'email' ]"
   present="_.reorder(REQUEST.form.keys(), with=required)"
   missing="_.reorder(required, without=present)">
<dtml-if missing>
Missing fields:
 <dtml-in missing><dtml-var sequence-item> </dtml-in><br>
  ... insert code here ...

Duncan Booth                                             [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to