Hi all again,

The Code Snippet is here 
http://jakarta.apache.org/turbine/turbine/turbine-2.3.1/xref/org/apache/turb
ine/services/intake/model/Field.html#201

The Reason is the following. If you have a field of type Boolean for
example. One would assume that a BooleanValidator would be instantiated as a
Validator, no matter if I put in a rule or not. But unless I put in a rule
of the type

<rule name="required" value="false">ValidValue</rule>

This is not the case, and a Validator of type new Boolean(stringValue); is
instantiated byte getBoolean here:
http://jakarta.apache.org/turbine/turbine/turbine-2.3.1/xref/org/apache/turb
ine/services/intake/model/BooleanField.html#146

So if you put something like this inside your form which is perfectly
working if you have the above rule inside your field ...

<input type="checkbox" value="1" name="$intake.myboolean.key"
#if($intake.myboolean.value) checked#end/>

Will not work if you leave the rules out. Then you would have to write
<input type="checkbox" value="true" name="$intake.myboolean.key"
#if($intake.myboolean.value) checked#end/>

Since the Boolean Creator only accepts true everything else is false and the
BooleanValidator accepts 1,true,t,y,yes for true and false,f,no,n,0 for
false.

I am really wondering if the Behaviour now is desired as is...

Kind regards

J�rgen Hoffmann
-----Urspr�ngliche Nachricht-----
Von: J�rgen Hoffmann [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 8. Dezember 2004 17:21
An: [EMAIL PROTECTED]
Betreff: turbine 2.3.1 intake service

Hi,

is there any special reason why the DefaultValidator for Fields only
gets instantiated if there is one or more rules?

Kind regards

Juergen Hoffmann



!EXCUBATOR:41b72a1a44709411119944!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to