cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist>
Subject Re: [cforms] Clear validation error on a widget?
Date Wed, 14 Apr 2004 18:50:01 GMT

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.
> Thanks... I'll try building from a fresh snapshot, and we'll see what 
> happens.

I tried, and I think it's worse now: the form is displayed with a 
validation error right upon clicking the action button that invokes 
addRow() on the repeater.  So now we're telling our user they did 
something wrong, when all they are doing is adding an entry :-(.

I don't think it did this before.

> 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, 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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message