cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: validating fd:booleanfield
Date Fri, 02 Jul 2004 09:12:45 GMT

On 2 Jul 2004, at 09:10, Bruno Dumon wrote:

> On Thu, 2004-07-01 at 19:06, Jeremy Quinn wrote:
> <snip/>
>>
>> OK, the ClassCastException has gone.
>>
>> However, the updated BooleanField still outputs no
>> <fi:validation-message/> even when given (what I believe to be) an
>> impossible to pass validation assert statement. <fd:assert
>> test="False()"> . . . </fd:assert>
>>
>> Can you think of anything else that may be missing?
>
> Yep, still two things (which should really be the last ones):
>
> 1. the validationError instance variable should be set to null in the
> method readFromRequest (just add that at the top or bottom of that
> method)
>
> 2. in the method generateItemSaxFragment, the validation error message
> should also be generated into the sax stream. For this, just copy the
> corresponding code from the Upload widget. It are these lines:
>
>         // validation message element: only present if the value is 
> not valid
>         if (validationError != null) {
>             contentHandler.startElement(Constants.INSTANCE_NS, 
> VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + 
> VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
>             validationError.generateSaxFragment(contentHandler);
>             contentHandler.endElement(Constants.INSTANCE_NS, 
> VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + 
> VALIDATION_MSG_EL);
>         }
>
> You'll also have to copy the VALIDATION_MSG_EL declaration.

Absolutely spot on !!
Yes it is working now, I feel blind for not seeing that!

Thanks for your help, I will get this committed.

regards Jeremy

--------------------------------------------------------

                   If email from this address is not signed
                                 IT IS NOT FROM ME

                         Always check the label, folks !!!!!
--------------------------------------------------------


Mime
View raw message