You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kevin Menard <km...@servprise.com> on 2007/11/09 21:57:34 UTC
[T5] BeanEditForm validations
Hi,
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 was hoping to be able to do this via the BeanModel, but I can't find a
way. Any help would be much appreciated.
Thanks,
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] BeanEditForm validations
Posted by Hugo Palma <hu...@gmail.com>.
You can do your validations in the onSuccess method in your page class
like what is described here
http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
All you do is access the edited object instance and use the BeanEditForm
object to register the errors.
Hope this helps...
Kevin Menard wrote:
> Hi,
>
> 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 was hoping to be able to do this via the BeanModel, but I can't find a
> way. Any help would be much appreciated.
>
> Thanks,
> Kevin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] BeanEditForm validations
Posted by Francois Armand <fa...@linagora.com>.
Kevin Menard wrote:
> 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.
>
Hello Kevin,
Did you move on on this issue ? I think your idea is really the best way
to go, and it seems rather simple to add to PropertyEditor.
Or perhaps did you find a better solution ?
--
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] BeanEditForm validations
Posted by Kevin Menard <km...@servprise.com>.
Hello Francois,
On 11/12/07 3:28 AM, in article 47380EC7.20507@linagora.com, "Francois
Armand" <fa...@linagora.com> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] BeanEditForm validations
Posted by Kevin Menard <km...@servprise.com>.
Hello Francois,
On 11/12/07 3:28 AM, in article 47380EC7.20507@linagora.com, "Francois
Armand" <fa...@linagora.com> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] BeanEditForm validations
Posted by Francois Armand <fa...@linagora.com>.
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 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.
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org