cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: [cforms] Clear validation error on a widget?
Date Wed, 14 Apr 2004 19:04:43 GMT

On Apr 14, 2004, at 11:50 AM, Mark Lundquist wrote:
> On Apr 14, 2004, at 10:37 AM, Mark Lundquist wrote:
>> On Apr 14, 2004, at 10:02 AM, Joerg Heinicke wrote:
>>> On 14.04.2004 18:36, Mark Lundquist wrote:
>>>> Hi,
>>>> I have a repeater whose rows contain:
>>>>     • a text field that notionally is required, but is not declared 
>>>> as such in the definition (see below)
>>>>     • a "delete me" booleanfield.
>>>> The field is not @required="true", because if the user clicks to 
>>>> add a row and then decides they don't want it after all, they must 
>>>> check the "delete me" box on that row and submit the form.  So this 
>>>> state (text field empty, box checked) must be valid.
>>>> So I'm doing a check in the form.onValidate handler.  I call 
>>>> setValidationError() on the text widget in the error case (field 
>>>> empty, "delete me" not checked), and that works fine.
>>>> But I also need the ability to clear the validation error if the 
>>>> field is empty and the "delete me" box is checked.  How do I do 
>>>> this?
>>>> I tried setValidationError (null), but that didn't do the trick.
>>>> Any ideas?
>>>
>>> I might be wrong, but I'm nearly sure I have both working: required 
>>> fields in a repeater, with delete me checkboxes and 
>>> setValidationError(null). I'm using still 2.1.4 Woody, so part I 
>>> might be caused by actions causing validation, but Sylvain has fixed 
>>> this yesterday, so this should work too.
>>
>> One of the bad behaviors I'm seeing right now is that after I call 
>> setValidationError (null) in the flowscript, I get output something 
>> like this from <fi:valdatation-errors>:
>>
>> 	Your form had the following errors:
>> 		• null
>> 	Please fix and resubmit
>
> I debugged a bit, and it turns out that 
> ScriptableWidget.jsFunction_setValidationError() is getting called 
> with a value of (String) "null" for its 'message' parameter.  It looks 
> like the conversion of null to "null" is happening in 
> org.mozilla.javascript.ScriptRuntime.call(), but I don't have that 
> source (do I?) so I can't tell exactly what is going on.  Anyway, if 
> that is the case then I am probably hosed, right?

I just added ScriptableWidget.jsFunction_clearValidationError(), and 
that seems to fix my trouble.  When I get the chance, I'll submit a 
patch, unless I hear otherwise...

~mark


Mime
View raw message