Bart Molenkamp wrote:

I saw that the validate method doesn't check for extra validations. I
think you need somethink like this:

<fd:booleanfield id="read_law">
 <fd:validation>
   <fd:javascript>
        return widget.getValue == java.lang.Boolean.TRUE;
   </fd:javascript>
 </fd:validation>
</fd:field>



</snip>

I had one of these lying around:

<fd:booleanfield id="policyAgree">
<fd:label>I Agree!</fd:label>
<fd:validation>
<fd:javascript>
if (!widget.value.equals(Packages.java.lang.Boolean.TRUE)) {
widget.setValidationError(
new Packages.org.apache.cocoon.forms.validation.ValidationError("Sorry, you have to agree with our policy if you want to continue!", false)
);
return false;
} else return true;
</fd:javascript>
</fd:validation>
</fd:booleanfield>


Note that you have to compare with the java.lang.Boolean.TRUE and j.l.B.FALSE:
if you would write


   if (!widget.value) { ...

validation would always return true.

HTH
Karel

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



Reply via email to