Re: Reporting form errors to the user
Re: Reporting form errors to the user
- Subject: Re: Reporting form errors to the user
- From: wojingo <email@hidden>
- Date: Fri, 09 Dec 2005 17:55:44 +1030
email@hidden wrote:
In my day job I build websites in a scripted environment. The
"conventional wisdom" on handling form validation errors goes like
this: the user goes to /foo and fills in the form. When they hit the
submit button, they are routed back to /foo again, except this time
it's a POST instead of a GET. The code within /foo is a giant
if-statement - if the request is a GET, set up the input form. If it's
a POST, validate the user's input and if there are errors, redisplay
the form with the data filled in and error messages beside each field
with problems. This is considered better than the alternative of
sending the user to a second script which would then have to contain
duplicate code to set up the form again if there were errors.
I have always hated this scenario; the files are large and unwieldy
and the if blocks are sometimes so big that it's possible to try to
debug the wrong one, wasting lots of time.
I was working on one of these monstrosities today and it got me
wondering how this is handled in WO. I looked at all of my WO books,
but I didn't see anything that covered this. Could someone give an
overview (at a newbie level) of how this is done?
Thanks in advance,
janine
Here is an old article that explains validation pretty well.
http://www.stepwise.com/Articles/Technical/WOValidation.html
Some of the method signatures have changed this was WO4 / WO4.5
days but it will give you the general idea.
eg) EOValidation.Exception was changed to
NSValidation.ValidationException when WO ditched Objective C.
regards,
- shaun
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden