That would fail if the form decides to hide one field and show instead
another (since the number of fields would not change).

The simplest solution I can think of is an interface (ErrorOrderPolicy
or whatever), specified as an ErrorsTag attribute. If none is
specified (default) order is not important. One implementation for
cached, tabindex-based order, and extending it to be noncached (or
viceversa) should be trivial.

On 2/2/07, Tim Fennell <[EMAIL PROTECTED]> wrote:
> It's a good question.  I think it'd essentially have to do two things.
>
> 1: capture the information on /each/ render, and save the information
> if there are more fields than the last time
> 2: if errors show up for fields that are not listed, show them at the
> end?
>
> It's not a fool-proof strategy, but I'm not sure what is.  As Barry
> suggests, it's possible the "fields present" hidden field could be
> used...but that's not always available, so there would have to be
> some kind of fallback.
>
> -t
>
> On Feb 2, 2007, at 9:01 AM, Ignacio Coloma wrote:
>
> > BTW, about caching: how does conditional forms (with embedded ifs and
> > fors) affect the possible caching of this data?
> >
> >
> > On 1/31/07, Barry Davies <[EMAIL PROTECTED]> wrote:
> >>
> >> Tim, could the auto-generated-by-Stripes FieldsPresent field
> >> berepurposed
> >> (for lack of a better word) to support this?
> >>
> >> -BD aka RJ
> >>
> >> ----- Original Message ----
> >> From: Tim Fennell <[EMAIL PROTECTED]>
> >> To: Stripes Users List
> >> <[EMAIL PROTECTED]>
> >> Cc: Stripes Development List
> >> <[email protected]>
> >> Sent: Wednesday, January 31, 2007 3:18:19 PM
> >> Subject: Re: [Stripes-dev] [Stripes-users] stripes:errors displays
> >> errors in
> >> sorted order, which is not required
> >>
> >> Hey Barry,
> >>
> >> Yes, I'd be open to patches....but I think this needs to be
> >> discussed in
> >> depth on the dev list before anyone attempts a patch.  I've cc'd
> >> that list
> >> and suggest we continue the discussion there....
> >>
> >> The best solution that I can think of that doesn't involve copious
> >> amounts
> >> of developer intervention per-use-case would be to have the s:form
> >> tag build
> >> up a cache of JSP->field ordering.  All Stripes fields register
> >> with their
> >> parent form tag - and assuming that the first pass render of the
> >> page isn't
> >> problematic, would allow Stripes to figure out and capture the
> >> order of the
> >> fields on the page (assuming Stripes tags are used).  It'd seem to be
> >> reasonable to hold this in a static Map of JspPath/Class -> List
> >> of Field
> >> names.  My only concern about this is that the footprint of
> >> caching this
> >> type of information for each and every JSP would be non-trivial.
> >>
> >> With this information in hand, the Errors tag could ask the form
> >> tag about
> >> the ordering, and use that to sort the errors appropriately.
> >>
> >> How does that solution sound to folks?  It sounds a bit more
> >> complex for
> >> sorting errors than I'd like....and I'm open to other solutions.
> >>
> >> -t
> >>
> >>
> >>
> >> On Jan 31, 2007, at 3:38 PM, Barry Davies wrote:
> >>
> >> I've had users ask about this same issue, as well.  I understand
> >> that a
> >> stripes-tag-based approach to this issue wouldn't be sufficient
> >> for every
> >> use case of stripes, but that doesn't mean that it isn't
> >> worthwhile.  I
> >> mean, I could choose to not use the <stripes:form> tag, but
> >> getSourcePageResolution() won't work without it--and that wouldn't
> >> have been
> >> a good reason to not create of getSourcePageResolution().
> >>
> >> Tim, how open are you to receiving patches from the community for
> >> attempts
> >> at providing a develper-specified order to validation errors?
> >>
> >> -BD aka RJ
> >>
> >> ----- Original Message ----
> >> From: Nic Holbrook <[EMAIL PROTECTED]>
> >> To: Stripes Users List
> >> <[EMAIL PROTECTED]>
> >> Sent: Wednesday, January 31, 2007 1:46:54 PM
> >> Subject: Re: [Stripes-users] stripes:errors displays errors in
> >> sorted order,
> >> which is not required
> >>
> >> Just tell the users to quit being so picky...  JK.
> >> A custom index property would work with a stripes tag
> >> but as Tim pointed out, you can use freemarker, plain
> >> old jsp, etc.  You don't necessarily need to use the
> >> stripes tags so it wouldn't cover every situation.
> >>
> >> Nic
> >>
> >>
> >> --- "Newman, John W" <[EMAIL PROTECTED]> wrote:
> >>
> >>> Ah I've always wondered why the errors come out in
> >>> "random" order.
> >>> Turns out it's not random and there's a good reason
> >>> for it, I just never
> >>> made the connection about the way the request params
> >>> are sent in.
> >>>
> >>> How about using the tabindex attribute to order the
> >>> errors?  Or maybe a
> >>> custom errorindex attribute?  Not a great idea
> >>> really but it would
> >>> quickly solve the problem. I've actually had a few
> >>> users mention "that
> >>> is weird, make them come up in the right order"
> >>>
> >>> <stripes:text name="username" tabindex="1" />
> >>> <stripes:text name="password" tabindex="2" />
> >>>
> >>> thoughts?
> >>>
> >>> - John
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED]
> >>> [mailto:[EMAIL PROTECTED]
> >>> On Behalf Of Tim
> >>> Fennell
> >>> Sent: Wednesday, January 31, 2007 9:25 AM
> >>> To: Stripes Users List
> >>> Subject: Re: [Stripes-users] stripes:errors displays
> >>> errors in sorted
> >>> order,which is not required
> >>>
> >>> This is actually *much* trickier than it would seem.
> >>>  You are right
> >>> in asserting that Stripes displays error messages in
> >>> alphabetical
> >>> order by field name.  The reason it does this is to
> >>> ensure some kind
> >>> of consistency in error reporting.
> >>>
> >>> The "display errors in the order it encountered the
> >>> error" is
> >>> essentially arbitrary from Stripes' perspective.
> >>> When a form is
> >>> submitted there is no ordering to the parameters in
> >>> the request, and
> >>> so the order in which they are validated and bound
> >>> is also arbitrary
> >>> (not random though).
> >>>
> >>> Given that the ordering of fields on the page isn't
> >>> required to
> >>> mirror the ordering of fields on the ActionBean (or
> >>> nested domain
> >>> objects), and often won't match, the only way to
> >>> figure out the
> >>> "right" order would be to somehow get the source of
> >>> the view and try
> >>> and parse out the fields in order.  Given that
> >>> Stripes supports JSP
> >>> and FreeMarker, and you aren't even required to use
> >>> the Stripes tags,
> >>> that's a bit difficult!!!
> >>>
> >>> For simple pages you can do the following:
> >>>    <s:errors field="username"/>
> >>>    <s:errors field="password"/>
> >>>
> >>> to force them out in order.  But for larger pages,
> >>> that's not
> >>> practicable.  If anyone has a good solution to this,
> >>> I'm all ears.
> >>>
> >>> -t
> >>>
> >>> On Jan 31, 2007, at 9:13 AM, Ignacio Coloma wrote:
> >>>
> >>>> Are you using annotations? If so, in which order
> >>> did you put them
> >>>> in place?
> >>>>
> >>>> On 1/31/07, Tulip Agarwal <[EMAIL PROTECTED]>
> >>> wrote:
> >>>>>
> >>>>> stripes:errors displays errors in sorted order,
> >>> which is not what
> >>>>> I require.
> >>>>> I want that it should display errors in the order
> >>> it encountered
> >>>>> the error.
> >>>>>
> >>>>> For eg, if there are two fields on page
> >>> "username" and "password"
> >>>>> and I
> >>>>> leave both the fields empty. I have validation on
> >>> both the fields.
> >>>>>
> >>>>> stripes:errors would display error for password
> >>> first and then for
> >>>>> username,
> >>>>> password is empty
> >>>>> Username is empty
> >>>>>
> >>>>> where as it should say that
> >>>>> Username is empty
> >>>>> password is empty
> >>>>>
> >>>>> Please help me if anyone has a solution.
> >>>>> --
> >>>>> View this message in context:
> >>> http://www.nabble.com/stripes%
> >>>>>
> >>>
> >> 3Aerrors-displays-errors-in-sorted-order%2C-which-is-not-required-
> >>>
> >>>>> tf3148349.html#a8727785
> >>>>> Sent from the stripes-users mailing list archive
> >>> at Nabble.com.
> >>>>>
> >>>>>
> >>>>>
> >>>
> >> ---------------------------------------------------------------------
> >>>
> >>>>> ----
> >>>>> Take Surveys. Earn Cash. Influence the Future of
> >>> IT
> >>>>> Join SourceForge.net's Techsay panel and you'll
> >>> get the chance to
> >>>>> share your
> >>>>> opinions on IT & business topics through brief
> >>> surveys - and earn
> >>>>> cash
> >>>>> http://www.techsay.com/default.php?
> >>>>> page=join.php&p=sourceforge&CID=DEVDEV
> >>>>> _______________________________________________
> >>>>> Stripes-users mailing list
> >>>>> [EMAIL PROTECTED]
> >>>>>
> >>>
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>>>
> >>>>
> >>>>
> >>>
> >> ---------------------------------------------------------------------
> >> -
> >>>
> >>>> ---
> >>>> Take Surveys. Earn Cash. Influence the Future of
> >>> IT
> >>>> Join SourceForge.net's Techsay panel and you'll
> >>> get the chance to
> >>>> share your
> >>>> opinions on IT & business topics through brief
> >>> surveys - and earn cash
> >>>> http://www.techsay.com/default.php?
> >>>> page=join.php&p=sourceforge&CID=DEVDEV
> >>>> _______________________________________________
> >>>> Stripes-users mailing list
> >>>> [EMAIL PROTECTED]
> >>>>
> >>>
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> ---
> >>> -
> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >>> Join SourceForge.net's Techsay panel and you'll get
> >>> the chance to share
> >>> your
> >>> opinions on IT & business topics through brief
> >>> surveys - and earn cash
> >>>
> >> http://www.techsay.com/default.php?
> >> page=join.php&p=sourceforge&CID=DEVDE
> >>> V
> >>> _______________________________________________
> >>> Stripes-users mailing list
> >>> [EMAIL PROTECTED]
> >>>
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> ----
> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >>> Join SourceForge.net's Techsay panel and you'll get
> >>> the chance to share your
> >>> opinions on IT & business topics through brief
> >>> surveys - and earn cash
> >>>
> >> http://www.techsay.com/default.php?
> >> page=join.php&p=sourceforge&CID=DEVDEV
> >>> _______________________________________________
> >>> Stripes-users mailing list
> >>> [EMAIL PROTECTED]
> >>>
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>>
> >>
> >>
> >>
> >>
> >> _____________________________________________________________________
> >> _______________
> >> Never Miss an Email
> >> Stay connected with Yahoo! Mail on your mobile.  Get started!
> >> http://mobile.yahoo.com/services?promote=mail
> >>
> >> ---------------------------------------------------------------------
> >> ----
> >> Using Tomcat but need to do more? Need to support web services,
> >> security?
> >> Get stuff done quickly with pre-integrated technology to make your
> >> job
> >> easier.
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Stripes-users mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>
> >>
> >>  ________________________________
> >> Have a burning question? Go to Yahoo! Answers and get answers from
> >> real
> >> people who know.
> >> ---------------------------------------------------------------------
> >> ----
> >> Using Tomcat but need to do more? Need to support web services,
> >> security?
> >> Get stuff done quickly with pre-integrated technology to make your
> >> job
> >> easier.
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642_____________________________
> >> __________________
> >> Stripes-users mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >> ---------------------------------------------------------------------
> >> ----
> >> Using Tomcat but need to do more? Need to support web services,
> >> security?
> >> Get stuff done quickly with pre-integrated technology to make your
> >> job
> >> easier.
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Stripes-development mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/stripes-development
> >>
> >>
> >>  ________________________________
> >>  Don't get soaked. Take a quick peak at the forecast
> >>  with theYahoo! Search weather shortcut.
> >> ---------------------------------------------------------------------
> >> ----
> >> Using Tomcat but need to do more? Need to support web services,
> >> security?
> >> Get stuff done quickly with pre-integrated technology to make your
> >> job
> >> easier.
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?
> >> cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Stripes-development mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/stripes-development
> >>
> >>
> >
> > ----------------------------------------------------------------------
> > ---
> > Using Tomcat but need to do more? Need to support web services,
> > security?
> > Get stuff done quickly with pre-integrated technology to make your
> > job easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > http://sel.as-us.falkag.net/sel?
> > cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Stripes-development mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/stripes-development
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Stripes-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-development
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to