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 HowardLewisShip: http://wiki.apache.org/jakarta-tapestry/CheckingForRequiredValidator ------------------------------------------------------------------------------ } }}} + + HowardLewisShip: In Tapestry 4.0, IFormComponent has a isRequired() method for this purpose. Iternally, it's kind of like your solution (but doesn't using OGNL or reflection). + + {{{ + public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) { + + if(field.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(); + } + + if(isInError()) { + writer.printRaw(" "); + writer.beginEmpty("img"); + writer.attribute("align","middle"); + writer.attribute("src","images/warning_icon.gif"); + } + }}} + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
