There are a couple of approaches to this.  Sounds like, for certain fields,
you want to display error messages specific to the field next to the field
(or something similar).

In your shoes, I would make a smarter validation delegate that would "sniff"
the fields to decide if they deserve special behavior.   Perhaps you will
need to subclass ValidField ... or use a particular naming pattern of the
component id ... or simply store a list of component ids somewhere
accessible to the validation delegate.

Here's an example ...

public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle)
throws RequestCycleException
{
    if (isSpecialField() && isInError())
    {
        writer.printRaw(" ");
        writer.begin("font");
        writer.attribute("color", "red");
        getComponentTracking().getRenderer().render(writer, cycle);
        writer.end();
        return;
    }

   super.writeSuffix(writer, cycle);
}


----- Original Message -----
From: "Richard Lewis-Shell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Tapestry Developer (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 3:00 PM
Subject: Re: [Tapestry-developer] Overriding the validation delegate?


> Oops - that reads wrong - it's one page that requires this out of about
200
> pages in our app.
>
> In this case - the complexity you refer to is exactly the behaviour we
> want - ie. we generally (ie. on 199 pages) want to display errors at the
top
> of the page and have a delegate/page structure that does this.  But now we
> want to display errors relating to certain areas on this new page right
> where the area is located.
>
> R
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Richard Lewis-Shell" <[EMAIL PROTECTED]>
> Cc: "Tapestry Developer (E-mail)"
<[EMAIL PROTECTED]>
> Sent: Friday, June 21, 2002 9:38 AM
> Subject: Re: [Tapestry-developer] Overriding the validation delegate?
>
>
> > 200 fields on one page!  There's this neat concept
> > called "multi-page wizard ..." :->
> >
> > The IValidationDelegate interface was designed with this
> > kind of thing in mind; you can override it and perform
> > special cases based on element name or component.
> >
> > Before I beefed up validation delegate in about 1.0.8,
> > this would have been more reasonable.  Now, though, with
> > the delegate tracking error messages and such for
> > everything ... its a whole can o' worms to allow some
> > fields to have thier own validation delegate; it makes
> > your app more complicated because you have to track in
> > multiple places whether there are errors or not.  Let me
> > stew on this a bit longer, or add a feature request and
> > hash it out there.
> >
> >
> > --
> > [EMAIL PROTECTED]
> >
> > http://tapestry.sf.net
> > > Hi,
> > >
> > > I'm wondering if it would make sense to be able to override the
> validation
> > > delegate on a per field basis?  Somewhere along the way the validation
> delegate
> > > was moved from ValidField to the Form which simplified things
somewhat.
> But now
> > > I have some fields (on one page out of about 200!) that need to have
> their
> > > errors handled differently from their form.  I am wondering if the
> delegate
> > > parameter could be put back in the ValidField component, but optional
> this time
> > > - if not specified then use the form's delegate.  Or might there be
> another way
> > > to use a different delegate for some fields?
> > >
> > > Any thoughts?
> > >
> > > Richard
> >
>
>



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to