You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2005/07/16 17:00:54 UTC
[Jakarta-tapestry Wiki] Update of "CheckingForRequiredValidator" by
ScottWalter
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Jakarta-tapestry Wiki" for change notification.
The following page has been changed by ScottWalter:
http://wiki.apache.org/jakarta-tapestry/CheckingForRequiredValidator
New page:
If you have a custom validation delegate (class that extends ValidationDelegeate) you may want to display a required field marker next to the field when the page is presented to your visitors.
If you are migrating a 3.0 application you will want to override writeSuffix() like this:
{{{
public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) {
if(component.getBinding("validator")!=null) {
ExpressionBinding expressionBinding = (ExpressionBinding) component.getBinding("validator");
BaseValidator singleValidator = (BaseValidator) expressionBinding.getObject();
if(singleValidator.isRequired()) {
writer.printRaw(" ");
writer.begin("span");
writer.attribute("class", "required-marker");
writer.beginEmpty("img");
writer.attribute("src","images/required.jpg");
writer.attribute("alt","required field");
writer.attribute("align","middle");
writer.end();
}
}
}
}}}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org