[Zope] Validating Form Data

Jim Penny jpenny@universal-fasteners.com
Tue, 5 Mar 2002 11:41:38 -0500


On Tue, Mar 05, 2002 at 09:19:16AM -0700, Mike Tran wrote:
> I am using the Javascript below to validate data on my form.  The part where 
> it validate form data works fine.  My problem is when I call on the method 
> "insertResume", my form variables does not get passed. 
> For example, on the form i have a textbox field called "age".  I reference 
> this in the "insertResume" method with <dtml-var age>, but the age variable 
> does not get passed from the form to the "insertResume" method.  
> 
> Does anyone have any idea on how to fix this or maybe show me how to validate 
> form data in Zope?  I've tried <dtml-unless> but the user have to go to 
> another page and go back to the form itself to correct the data. With 
> Javascript the user can stay on the same page. 

Actually this is not true.  Consider the following kind of dtml

<form method=post action=.>
  <dtml-if "error_message">
     <font color=red><dtml-var error_message></font>
  </dtml-if>
  The usual rest of form.
</form>

validation does require a round trip to server, but does not require
changing pages, at all.  Certain early version of mozilla got confused
by this.

If you use javascript, you are making some assumptions about the
browsers being used, and the willingness of users to accept risk, and
the absence of firewalls between you and your audience.

In particular, see http://security.greymagic.com/adv/gm001-ie/

Perhaps this risk is acceptable to you, perhaps the limitation of
audience is acceptable to you.  But necessity is not a reason to use
javascript in this case (although it may be more convenient to you).

Jim Penny
> 
> Thanks,
>