Thanks for your comments everybody.... I fiiiiiinally found the answer :)
I'm still using the DynaValidatorForm, and basically just had to do what
Laurie recommended in her 2nd point.
I just need to check for messages on the JSP page using the messagesPresent
logic tag... ie:
<logic:messagesPresent>
<script>
setTimeout('self.scrollBy(0,500)', 300);
</script>
</logic:messagesPresent>
Using "document.location" would cause an infinite loop, so I basically
needed to scroll down the page using a timeout.
*Phew... Struts has so many crazy tags, I learn new ones every day :D
Thank to all that helped, and let me know if you have any
suggestions/questions.
Thanks !
==
Dylan
On 6/22/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
>
> I'm not sure if you can tell the browser to scroll to an anchor from
> within the page (rather than in the URL). It would have to be done using
> Javascript, HTML doesn't provide this.
>
> Other than Javascript, I can think of two possibilities:
>
> 1) in your JSP, check for errors and, if they exist, render a browser-side
> redirect as the response where the redirect is to the same URL but with the
> anchor appended. You'd have to put any data the page needed into session
> scope (or append it to the redirect URL) to maintain it across the redirect,
> though.
>
> 2) if the input to the validating action is a path to a JSP (as opposed to
> a Tile name or action), you can add the anchor there. I.e. in
> struts-config.xml for your action, you'd include
>
> input="/path/to/page.jsp#anchor"
>
> That way, if validation fails, it'll forward to the 'input' path which
> includes the anchor you need to target.
>
> HTH,
>
> L.
>
> Dylan Stamat wrote:
> > Thanks Wendy !
> >
> > The problem I'm running into is that since I'm using a
> DynaValidationForm,
> > and errors are found, I'm never even reaching my Action... so, the
> setting
> > of the anchor in the request wouldn't work.
> >
> > I would somehow need to determine if there "were" errors on the JSP page
> > itself (like the struts tag "html:errors" does)... and then apply the
> > necessary logic.
> >
> > Any ideas ? Thanks !
> > ==
> > Dylan
> >
> > On 6/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> >
> >>From: "Dylan Stamat" <[EMAIL PROTECTED]>
> >>
> >>>When validation finds that there are errors, and returns to the form
> >>
> >>page
> >>
> >>>with displayed errors... I want to anchor to the lower part of the
> large
> >>>form page... so, only the errors and the form shows... not the text
> >>
> >>above.
> >>
> >>>Anybody have any ideas on how to do this !?
> >>>I've tried about 100 different hacks, with no luck.
> >>
> >>The problem is that when the page is rendered (when the links and form's
> >>action are determined) you can't _know_ whether or not there will be
> >>errors.
> >>It hasn't been submitted yet... the user hasn't even seen it.
> >>
> >>See if this helps:
> >>http://wiki.wendysmoak.com/cgi-bin/wiki.pl?JumpToAnchor
> >>
> >>You'd probably want to test for the presence of errors, and skip setting
> >>the
> >>request attribute.
> >>
> >>--
> >>Wendy Smoak
> >>
> >>
> >>---------------------------------------------------------------------
> >>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]
>
>