You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2005/06/28 02:05:00 UTC

Validation part II

Well, how do I set the display-name of a validField to come from a
properties resource? Is it possible? Also, how do I set the message
for each error (let's say for required)

Your field {0} is required and can not be left blank.

where {0} is the field name :P

Regards

Viniciu

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Validation part II

Posted by Pablo Ruggia <pr...@gmail.com>.
On 6/27/05, Vinicius Carvalho <ja...@gmail.com> wrote:
> 
> Hum reading again, I don't know if I made my self clear :P
> 
> What I like is to display the error that happened for each component.
> Let's say the inputName component was null and I have a validator bean
> defining it as required. how to output a localized message like: Name
> can't be null
> and if that component has another validation let's say minLengh=8, a
> message Name can't have less than 8 chars...


You will have to work a little to get that. Validators records errors in 
form's ValidationDelegate. So actually, you can have more than one error for 
each component. But default tapestry validation records only the first error 
throwing a ValidatorException.
You can do your customized validation and get that working. But I think that 
one error for component is good enough.
Besides, in Tapestry 4.0 there will be a much better validation support, I 
would not lost my time with that.


BTW how do I set more than one bean as my validator on my ValidField 
> component?


Nop, you cant do that. You will have to create some wrapper that have more 
than one validator inside.




Thanks
> 
> Vinicius
> 
> On 6/27/05, Vinicius Carvalho <ja...@gmail.com> wrote:
> > Well, how do I set the display-name of a validField to come from a
> > properties resource? Is it possible? Also, how do I set the message
> > for each error (let's say for required)
> >
> > Your field {0} is required and can not be left blank.
> >
> > where {0} is the field name :P
> >
> > Regards
> >
> > Viniciu
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: Validation part II

Posted by Vinicius Carvalho <ja...@gmail.com>.
Hum reading again, I don't know if I made my self clear :P

What I like is to display the error that happened for each component.
Let's say the inputName component was null and I have a validator bean
defining it as required. how to output a localized message like: Name
can't be null
and if that component has another validation let's say minLengh=8, a
message Name can't have less than 8 chars...

BTW how do I set more than one bean as my validator on my ValidField component?

Thanks

Vinicius

On 6/27/05, Vinicius Carvalho <ja...@gmail.com> wrote:
> Well, how do I set the display-name of a validField to come from a
> properties resource? Is it possible? Also, how do I set the message
> for each error (let's say for required)
> 
> Your field {0} is required and can not be left blank.
> 
> where {0} is the field name :P
> 
> Regards
> 
> Viniciu
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org