Yes - you can do much with the delegate :)
BTW - consider using CSS for this instead of adding elements , it might
be more elegant and easier to maintain...

Cheers,
Ron

Reto Hotz wrote:
> Hi,
> 
> On 10/10/06, Ron Piterman <[EMAIL PROTECTED]> wrote:
>> Dave Rathnow wrote:
>> > Also, is there an easy way to get the individual error messages from
>> the
>> > validation delegate?
>>
>> In such a case you need to create your own class, extending the standard
>> validation delegate. There are methods which allow the delegate to hook
>> up into the rendering of fields and their labels, so you can do just
>> what you described.
> 
> We also wrote our own validation delegate with nice error-icons.
> Somehow like this:
> 
> public class MyValidationDelegate extends ValidationDelegate {
> 
>    public void writeAttributes(IMarkupWriter writer, IRequestCycle
> cycle, IFormComponent component, IValidator validator) {
>        if (isInError())
>            writer.attribute("class", "validationerror");
>    }
> 
>    public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle,
> IFormComponent component, IValidator validator) {
>        if (isInError()) {
>            writer.print(" ");
>            writer.beginEmpty("img");
>            writer.attribute("src", "warning_small.gif");
>        }
>    }
> 
>    public void writeLabelPrefix(IFormComponent component,
> IMarkupWriter writer, IRequestCycle cycle) {
>        if (isInError(component)) {
>            writer.begin("span");
>            writer.attribute("class", "label-error");
>        }
>    }
> 
>    public void writeLabelSuffix(IFormComponent component,
> IMarkupWriter writer, IRequestCycle cycle) {
>        if (isInError(component))
>            writer.end(); // <span>
>    }
> }
> 
> 
> HTH
> 
> Greetings
> Reto
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to