cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Binding to an fd:booleanfield
Date Thu, 01 Jul 2004 07:44:18 GMT
On Thu, 2004-07-01 at 09:32, Colin Paul Adams wrote:
> Binding of an xs:boolean attribute in an XML file to a form with an
> fd:booleanfield does not work as I would expect it to.
> 
> For an attribute a of type xs:boolean, I would expect:
> 
> a="true" or a="1" to set the checkbox.
> a="false" or a="0" or the absence of an a attribute to unset the
> checkbox.
> Anything else to signal a validation error.
> 
> I find that setting the a attribute to ANYTHING AT ALL (even the empty
> string!) sets the checkbox, and only the absence of the attribute
> unsets it.
> 
> Is this the proper behaviour? 

Are you using a convertor in the binding? Should be I suppose, otherwise
you'd get a classcastexception.

The PlainBooleanConvertor (the only convertor there is for booleans)
uses java's Boolean.valueOf which only returns true if the string value
equals, ignoring case, "true".

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message