>link has overridable String getAnchor()

It's actually 'Component getAnchor()' and I don't understand where to get
this anchor component.  There is little javadoc in getAnchor() but
setAnchor(Component c) has more details but I don't understand it at all.

My page is like this:

=== top of page ===
...
<a href="#setup">Go To Setup</a>
... very long stuffs follow
.
.
.
bottom of page
<a name="setup">Setup Form</a>
<form>....
    ....
    <a wicket:id="resetKey">Give me another key</a>
    ....
</form>

I want response to onClick of "resetKey", jump back to #setup.  I don't
understand how to use Link#getAnchor(), Link#setAnchor(Component c) do
this.  Please help.

>>  1) on fail form validation, response jump to the form?
>
>this is a bit tricky. perhaps you can subclass the feedbackpanel and
>if there are messages have it spit out some javascript to scroll the
>page.

Javascript is fine.  But I am not using FeedbackPanel. I am pulling the
error message out from FormComponents and show them along side it.  Can I
just query the session to see if it has any error?  If so, where and how to
insert his code and do the "spit out some javascript"? And what is the
javascript? "location.hash='setup'"?


On Wed, Mar 26, 2008 at 11:26 AM, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:

> On Wed, Mar 26, 2008 at 11:13 AM, Matthew Young <[EMAIL PROTECTED]> wrote:
> > My form is at the bottom of a long page.  I have <a name="myform"/>
> before
> >  the form.  Is there a way to:
> >
> >  1) on fail form validation, response jump to the form?
>
> this is a bit tricky. perhaps you can subclass the feedbackpanel and
> if there are messages have it spit out some javascript to scroll the
> page.
>
> if you dont want javascript then you will need an extra redirect in
> which case you will need to do:
>
> string url=urlfor(mypage.this); url+="#anchor";
> requestcycle().setrequesttarget(new redirectrequesttarget(url));
>
> but you may or may not lose some feedback messages, not sure.
>
> >  2) Same for [EMAIL PROTECTED](): response jump to the form?
>
> link has overridable String getAnchor()
>
> -igor
>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to