Kevin Menard wrote:
Hi,
Hello,
Is there anyway to configure validation for a BeanEditForm other than with
the Validate annotation? I'd like to have validation, but really can't
apply the annotations because I'm working with classes coming out of a
library.
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).
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-common/trunk/src/main/java/org/interldap/wui/t5lib/components/ldapentry/
A brief description :
* MyPropertyEditor is just a copypast 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.
Hope it will help !
--
Francois Armand
Etudes Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
---
InterLDAP - http://interldap.org
FederID - http://www.federid.org/
Open Source identities management and federation
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]