cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bart Molenkamp" <>
Subject RE: ValidationAware forms
Date Fri, 03 Jun 2005 14:07:27 GMT

> Van: Sylvain Wallez []
> Bart Molenkamp wrote:
> >
> >
> >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
> 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
> repeaters are a similar case (aren't ValidationErrorAware either, but
> 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.

It would be nice to set an error on the repeater if it has no rows, and
least one row is required.

> 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
> type "either change this _or_ change that" and that's where the
> 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.
> can be a good replacement of the message widget, and would allow
> non-visual widgets to be ValidationAware.

So, then all widgets can implement ValidationErrorAware. For most
widgets, the forms-styling.xsl knows how to display the error. For the
other, special
cases we could use <ft:validation-error> to display the error. Am I
on this?

If so, it seems like a good solution to me.


View raw message