Re: What is the best way to handle invalid values from a WOTextField?
Re: What is the best way to handle invalid values from a WOTextField?
- Subject: Re: What is the best way to handle invalid values from a WOTextField?
- From: Chuck Hill <email@hidden>
- Date: Wed, 16 Jul 2008 10:11:05 -0700
On Jul 16, 2008, at 9:42 AM, Guido Neitzer wrote:
On 16.07.2008, at 10:34, Chuck Hill wrote:
I am guessing this is an attempt to deal with the problem of the
input value getting discarded if it failed to format. It is
reasonable to want to show the invalid value to the user with a
message and allow them to edit it into the correct format. This is
just the wrong way to do that.
Hmmm, is there any other way than binding to a string variable in
the EO and if it parses set the date / number value from it and if
not throw an exception but keep it in the variable? If I attach a
formatter to a text field because I NEED to format a string into a
number or date object, it is just plain impossible to push that
value into the object (ClassCastException). So do I not understand
how that was ever intended to work or is it really just a bad idea
in the first place?
It won't work as written. It could work if internally (or in a
wrapping component) this was done:
setValue:
- clear any failedToFormatValue
- attempt to format value
- if value formats OK, set formatted value with association bound to
value
- if value fails to format, set input value into failedToFormatValue
value:
- if failedToFormatValue is not null, return that
- return value from association bound to value
To maintain failedToFormatValue, this either has to be a stateful
component or some generic state mechanism (e.g. userInfo) at the
context/page/component above WOTextField needs to be used to cache
this value (e.g. under the element ID).
So it can be done, but not like it is in 5.4.2
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
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:
This email sent to email@hidden