You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Trunick <Jo...@SmartPrice.com> on 2003/03/19 01:06:44 UTC
Error Messages on Valid Field
Is there a way to change the default messages for ValidField?
ie. Change "Must fill in zip code" to "Please tell us your zip code"
Joel
Re: Error Messages on Valid Field
Posted by Bill Lear <ra...@zopyra.com>.
On Tuesday, March 18, 2003 at 18:06:44 (-0600) Joel Trunick writes:
>
>Is there a way to change the default messages for ValidField?
>
>ie. Change "Must fill in zip code" to "Please tell us your zip code"
This is just on the edge of my competence at the moment, so you
are warned:
protected void setErrorField(String componentId, String message) {
IFormComponent field = (IFormComponent) getComponent(componentId);
IValidationDelegate delegate = getValidationDelegate();
delegate.setFormComponent(field);
delegate.record(new ValidatorException(message));
}
public void listenerMethod(IRequestCycle cycle) {
try {
do something;
} catch (Exeption e) {
// handle
setErrorField("passwordField", "Invalid password, dork!");
}
}
See Vlib for details.
Bill
RE: Error Messages on Valid Field
Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
You can create your own sublcass of validation delegate and override
record().
Or, you can create your own subclass of StringValidator.
Hm. A good feature enhancement would be to allow easier overriding of
validator error messages.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry
> -----Original Message-----
> From: Joel Trunick [mailto:Joel@SmartPrice.com]
> Sent: Tuesday, March 18, 2003 7:07 PM
> To: 'Tapestry users'
> Subject: Error Messages on Valid Field
>
>
>
> Is there a way to change the default messages for ValidField?
>
> ie. Change "Must fill in zip code" to "Please tell us your zip code"
>
> Joel
>