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]