cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: ValidationAware forms
Date Fri, 03 Jun 2005 13:35:32 GMT
Bart Molenkamp wrote:

>  
>
>>-----Oorspronkelijk bericht-----
>>Van: Reinhard Poetz [mailto:reinhard@apache.org]
>>Verzonden: vrijdag 3 juni 2005 9:46
>>Aan: dev@cocoon.apache.org
>>Onderwerp: ValidationAware forms
>>
>>
>>AFAICS the widget "Form" doesn't implement ValidationAware. Is there a special reason
why this feature hasn't been added yet?
>>    
>>
>
>I'm not sure, but I think it is because a form doesn't have a visual representation in
HTML, where other widgets do have a visual representation. Where should CForms place the error
marker (the red "!") for a form?
>  
>

That's exactly the reason: only widgets who have a visual representation 
can be made validation-aware, as otherwise we don't know how/where to 
display the error.

>I agree that it will be helpful to have this feature. And I think that repeaters are a
similar case (aren't ValidationErrorAware either, but I have cases here where I want it to
hold an error instead of creating a messages widget).
>  
>

The form1 sample has a validator on the "contacts" repeater, which 
checks uniqueness of {firstName,lastName} on the various rows. If a 
duplicate is found, the error is set on the offending row as its the 
most precise location indicating to the user where the problem is. 
Attaching the error to the repeater itself would make finding the 
problem more difficult.

The same reasoning can be applied to the form object. Since an error 
means the user has to change something, then we'd better indicate 
precisely what should be changed. Now in some cases the error can be of 
type "either change this _or_ change that" and that's where the message 
widget is usefull.

Hmm...

Now there's also the little-known <ft:validation-error> template 
instruction that outputs the validation error or any given widget. This 
can be a good replacement of the message widget, and would allow 
non-visual widgets to be ValidationAware.

WDYT?

Sylvain

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


Mime
View raw message