I was wondering what the best way to validate a users input on a page. Currently I submit a page to an interim page that checks for certain values using dtml-if's and dtml-unless'. If everything is fine I go on to the next page. If something is missing I need to go back, I haven't figured out how to do this part. If I use <META HTTP-EQUIV="refresh" content=5;URL=<dtml-var "REQUEST['HTTP_REFERER']">> all the input is lost from the form. So my questions are: 1. What is the best way to do page validation before it is submited. 2. If the way I am doing it seems to be an ok way, how do I go BACK with out losing everything (equivalent of pressing the back button) Stuart Foster MediServe Information Systems
I find the best way is to do <dtml-if item><dtml-var item><dtml-else>* needed</dtml-if> on the fields of the form and have <dtml-try> trying to do something with all the values (email, write, update database). If they are not all there it brings you back the the form (I always build it in one method which makes it easier). Examples: http://market.gotschool.com/register.html?type=school - in production so leave out your email http://fundraising.gotschool.com/tell_a_friend.html J
From: Stuart Foster <stuartf@MediServe.com> Date: Wed, 21 Jun 2000 10:39:48 -0700 To: "'zope@zope.org'" <zope@zope.org> Subject: [Zope] Validating page entry help
I was wondering what the best way to validate a users input on a page.
Currently I submit a page to an interim page that checks for certain values using dtml-if's and dtml-unless'. If everything is fine I go on to the next page. If something is missing I need to go back, I haven't figured out how to do this part. If I use <META HTTP-EQUIV="refresh" content=5;URL=<dtml-var "REQUEST['HTTP_REFERER']">> all the input is lost from the form.
So my questions are:
1. What is the best way to do page validation before it is submited. 2. If the way I am doing it seems to be an ok way, how do I go BACK with out losing everything (equivalent of pressing the back button)
Stuart Foster MediServe Information Systems
_______________________________________________ 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 )
In article <67C24441BF9ED311B91D00609760E13C25AEC9@msprime.mediserve.com
, Stuart Foster <stuartf@MediServe.com> writes 1. What is the best way to do page validation before it is submited. 2. If the way I am doing it seems to be an ok way, how do I go BACK with out losing everything (equivalent of pressing the back button)
Stuart Foster MediServe Information Systems
Never go back - always go forward! http://www.zope.com/Members/gchiu/ Explanation of one way to build bullet proof data entry forms -- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.co.nz/index.php Powered by Interbase and Zope
participants (3)
-
Graham Chiu -
J. Atwood -
Stuart Foster