cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Repost from users list: Cforms Repeater - Cancel delete action via javascript
Date Tue, 30 Aug 2005 17:17:14 GMT
Christoph Hermann wrote:

>Sylvain Wallez schrieb:
>
>Hello,
>
>  
>
>>>>Then you can simply call someWidget.setValidationError(...) from within
>>>>your event listener.
>>>>        
>>>>
>
>  
>
>>>Well this is actually what is not working.
>>>If i do a repeater.setValidationError(...); in my "normal" action, i do
>>>not get any validation error (as written in the docs: "When an action
>>>widget was activated, validation will not be performed. ...").
>>>      
>>>
>
>  
>
>>Well, although a repeater, as every widget, can have a validation error,
>>there's no associated presentation defined for it in the styling
>>stylesheets, which explains why you don't see the error!
>>    
>>
>
>Okay. Thanks for your help so far. I get the validation Error displayed,
>but not correctly:
>repeater.setValidationError(new
>Packages.org.apache.cocoon.forms.validation.ValidationError("general.field-required",false));
>
>This is ok, but the error displays as "".
>
>When i try to enable i18n:
>
>repeater.setValidationError(new
>Packages.org.apache.cocoon.forms.validation.ValidationError("general.field-required",true));
>
>OR
>
>repeater.setValidationError(new
>Packages.org.apache.cocoon.forms.validation.ValidationError("someString"));
>
>i get:
>---snip---
>org.apache.cocoon.transformation.I18nTransformer: nested i18n:text
>elements are not allowed. Current state: 10
>
>org.apache.cocoon.ProcessingException: Error executing pipeline.:
>org.xml.sax.SAXException:
>org.apache.cocoon.transformation.I18nTransformer: nested i18n:text
>elements are not allowed. Current state: 10
>---snap---
>
>I copied a Stacktrace to the end of this message.
>  
>

Wow... are you sure you don't have a surrounding i18n:text in your 
template? What shows up if you place an XML serializer right before the 
i18n transformer?

>  
>
>>>Even when calling form.validate(); (This is what i did).
>>> 
>>>
>>>      
>>>
>>form.validate() validates the whole form by calling each widget's
>>validators. This isn't what you want to do here.
>>    
>>
>
>I thought (referring to the docs) that no validation takes place when
>submitted via a "normal" action. This is why i wanted to trigger the
>whole Form validation.
>  
>

Yes, no validation takes place with actions. And validating the form is 
not what you want here! What you want is to give some feedback 
explaining why the action cannot be performed in this case.

So in that case, the validation error is actually a message, which makes 
me think that it may actually not be the right solution: this is more a 
job for <fd:message> whose value is reset at each form interaction, 
making it therefore suitable for transient information like is the case 
here.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message