Hello Francois,

On 11/12/07 3:28 AM, in article [EMAIL PROTECTED], "Francois
Armand" <[EMAIL PROTECTED]> wrote:

> I see at least two other way, one simple and one other a little more
> complicate.
> 
> The first one is to use the "validate" parameter in a property editor
> override in the BeanEditForm template.
> See "Property Editor Overrides" in
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html
> You might also add your custom property editors with their  template
> (and  so their  fields with validate  parameter).

While that certainly would work, at that point I'm essentially building the
form by hand, so BeanEditForm really didn't do anything for me.

> The other one is the programmatic way, but you should not need it for
> common use of BeanEditForm.
> If you want to customize globaly the validation proces,  you may extend
> the PropertyEditor component and play with FieldValidator and
> fieldValidatorSource service. You also will have to extend the
> BeanEditor component template to use you new property editor, and the
> beanEditForm so that it uses the new BeanEditor.
> If you want, I have an example of such a thing here :
> http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-com
> mon/trunk/src/main/java/org/interldap/wui/t5lib/components/ldapentry/
> A brief description :
>  * MyPropertyEditor is just a copy&past of T5 PropretyEditor, with some
> visibility change on methods, you may forget it ;
>  * ** AttributeEditor ** is a special editor for the kind of attribute I
> have to deal with in my app. It extends MyPropertyEditor (read
> PropertyEditor) and
>        It is the intersting component in which my personal validation
> process is done. Basically, I want to add a "required" validator if the
> attribute has a mandatory parameter set to true.
> * AttributeBeanEditor & EntryBeanEditor. I think they are not to
> interesting for what you want to do, but if you look to their template,
> you will see that AttributeBeanEditor calls  AttributeEditor and that
> EntryBeanEditor calls AttributeBeanEditor.

This is an interesting approach, but way more overhead that I was hoping
for.  I guess I would have liked to see a way to do this via the
PropertyConduit or something.  So, I could do
model.add("new_prop").addValidator("required");

I guess I'll file a JIRA for that.

Thanks again,
Kevin



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to