Re: Reusable Subcomponent Dependent Form Values Validation Question
Re: Reusable Subcomponent Dependent Form Values Validation Question
- Subject: Re: Reusable Subcomponent Dependent Form Values Validation Question
- From: Nathan Hampton <email@hidden>
- Date: Sun, 6 Feb 2005 13:39:06 -0800
Okay, this is cool: my exact question has already been answered.
BUT... (Like you couldn't see that one coming a mile away...)
We need graceful error handling: if the validation fails, I need to
notify the user so the user can take corrective action. The only way I
can think of to do this is to override takeValuesFromRequest in the
parent component so that the call to the superclass is within a try
block. If the validation fails, I catch the exception thrown by the
subcomponent and notify the user in my usual manner. This doesn't seem
particularly elegant to me, which usually means I'm doing something
wrong. Does anyone have a better idea?
--Nathan Hampton (email@hidden)
On 06 Dec 2004, at 10:15 AM, Chuck Hill wrote:
invokeAction may not work depending on (a) whether your action method
returns null or no, and (b) the relative position (before or after) of
the submit button. Neither makes for a good resuable component. Why
not do it in takeValuesFromRequest after calling super? The validate
and set logic seems more appropriate to setting values than performing
an action.
Chuck
On Dec 2, 2004, at 12:45 PM, Kieran Kelleher wrote:
I have two Strings, password and passwordRepeated within a resuable
UserEdit component with a binding to "User usr" in the parent
component. The usr EO has an attribute hashedPassword where the final
SHA hashed password is stored. The parent component has the Submit
and form for the page.
Where would I validate and compare "password" and "passwordRepeated"
within the reusable component and then hash and set the EO's
attribute?
(Normally I would do this on the Submit action method, but this
exists in the parent. Studying Chucks book, chapter 5, I am thinking
I should over-ride invokeAction, call super.invokeAction() and
afterward compare my two values and throw a validation exception if
different, otherwise hash and store in the EO? ... would that be the
proper approach?)
________________________________________________________________
Dev Config = OS X 10.3.5 / Java 1.4.2_05 / WO 5.2.3 / XCode v1.5 /
MySQL 4.0.20 / Connector-J 3.0.11
Deploy Config = OS X 10.3.5 Server / Java 1.4.2_05 / WO 5.2.3 / MySQL
4.0.20 / Connector-J 3.0.11
My Blog: http://webobjects.webhop.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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