On Fri, 2003-09-26 at 10:59, Sylvain Wallez wrote:
TO ALL:
I invite you to look at the "Various", "Flowscript" and "Car selector" Woody samples in the latest CVS. These demonstrate the styling and event-handling features I added to Woody, and I'd be interested in having feedback on this.
No time to look in detail at it right now, but I noticed a little problem with the car selector: if I select a make, type and model, and then change the make again, it gives an exception.
Doh ! I forgot to cvs add a new source file (EmptySelectionList). Should be ok now !
<snip/>
An noticeble thing, though : calling Field.getValue() _validates_ the field's value, meaning that even if the whole form should not be validated, local validation messages can appear, related to the event handlers that have been triggered. This gives some useful feedback to the user when an intra-form action cannot be performed because the fields used by this action are invalid.
Hmmm, wouldn't it then be better to add an isValid() method to the Widget interface? I think it's best if getValue() simply returns the value, and doesn't cause any magic side-effects. Also, previously getValue() returned the value of the widget even if it wasn't valid, and the conversion from string to object was done in the readFromRequest() method.
I wanted getValue() to return something only if the value is fully valid, and not only syntactically correct. Otherwise an application may break simply because the value is out of range if it forgets to check isValid(). This behaviour protects the application.
But I was also thinking about adding a getEnteredValue() which would return the String value read on the request, even if not valid. This would allow to get the raw value in the cases where it's needed.
What do you think ?
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
