Re: Validation retruns the same page
Re: Validation retruns the same page
- Subject: Re: Validation retruns the same page
- From: Florijan Stamenkovic <email@hidden>
- Date: Fri, 27 May 2005 16:59:47 +0200
On May 27, 2005, at 13:56, email@hidden wrote:
Hello,
after an error happend.
After the form submitted values that failed validation (for example not
typing in a field that requires it)
the method
-------------------------------------------------------------------
public void validationFailedWithException( Throwable e, Object
value,
String keyPath )
{
}
-------------------------------------------------------------------
will execute.
My question is, how can i return the same page where the error happend?
What I do when I am forced to use validationFailedWithException(), is
that I set a boolean invalidInput = true within it. As
validationFailedWith... is called just after submitting the form, and
since normally a method is performed just after it, I just check my
boolean to see if validationFailedWithException failed, and return the
same page then. Of course, you must reset your boolean in awake() (i do
it in sleep()) methods of the component, otherwise it stays around
forever...
I am not sure this is a good pattern to make. I ONLY use it when I have
to edit an EO. That is because if I have that EO, and it is old, and it
is by itself ok, then if on submit you fail validation with your
changes, the changes will not be applied, and you can not validate your
object in the invokeAction phase. I mean, you can, but you will not see
the changes because they will not be applied. If it is a new EO, with
no values set yet, then I ignore validationFailedWith.. and just call
validateForSave on the EO in my action.
I was also wondering about this system actually, and the way I solve
it, the editing of an old EO at special... Any comments?
Flor
Thank you in advance.
_______________________________________________
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
_______________________________________________
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