Yes, it is just a placeholder to get some sort of functionality. You are
right, the url would be a moot point if I returned false like you have
specified. But then how to I get anchors to work? The oddness is this: a
static html page that I have created just appends the '#' onto the end of
the url of the page it's on. On my generated tapestry page, the url is
different.

Try this code:

<a href="#section1">sec1 jump</a>
<a href="#section2">sec2 jump</a>
<a name="section1"/>
This is section one.<br/>
This is section one.<br/>
This is section one.<br/>
<a name="section2"/>
This is section two.<br/>
This is section two.<br/>
This is section two.<br/>

On a static html page, when you mouseover the jump links, it will append
#section1 or #section2 onto the end of the url (something like
blah.com/index.html#section1 <http://blah.com/index.html#section1>). When
you click on it, you just jump down the page. On my tapestry pages, the url
is like "blah.com/#section1 <http://blah.com/#section1>", which just takes
me to the home page. This confuses me and seems wrong.

-Chris

On 11/1/05, Robert Zeigler <[EMAIL PROTECTED]> wrote:
>
> Q: You said you don't want to send a request to the server at all,
> right? The anchor is really just a placeholder... a place for people to
> click to get at some sort of functionality, right? Thus, the browser
> shouldn't take you anywhere; the url should be a moot point, right?
> If that is the case, then your javascript is borked.
> You need: onclick="return jsFunction()" and your js function needs to
> return false. Alternatively, you could do:
> onclick="jsFunction();return false";
> If that still doesn't work, then your js is still borked; the js
> interpreter to dying trying to interpret your js, before it gets tot he
> "return false".
>
> If I'm misunderstanding what you're trying to do, my apologies. I'll
> readily admit to having only hastily read any of the msgs in this thread.
>
> Robert
>
> Chris Norris wrote:
> > I don't think tapestry is trying to fix anything up for me here. It
> seems
> > like the browser has the wrong idea of what it should append the # to.
> To
> > make sure thought I tried the following things:
> >
> > <a jwcid="@Any" href="ognl:'#'" onclick="jsFunction();">
> > <a jwcid="@Any" href="ognl:getLink()" onclick="jsFunction();">
> > <a jwcid="@Any" href="ognl:link" onclick="jsFunction();">
> >
> > They all do the same thing. The onclick is called, and then I am sent to
> the
> > home page.
> >
> > On 11/1/05, Patrick Casey <[EMAIL PROTECTED]> wrote:
> >
> >>
> >>Chris,
> >>
> >>In my example the "ognl:getLink()" function was actually calling
> >>through into a page function to get the link.
> >>
> >>So you could then put a method like:
> >>
> >>public String getLink() {
> >>return "#";
> >>}
> >>
> >>On your page which should bypass tapestry trying to fix it up for
> >>you (I hope).
> >>
> >>--- Pat
> >>
> >>>-----Original Message-----
> >>>From: Chris Norris [mailto:[EMAIL PROTECTED]
> >>>Sent: Tuesday, November 01, 2005 9:12 AM
> >>>To: Tapestry users
> >>>Subject: Re: anchor tags
> >>>
> >>>I tried this:
> >>>
> >>><a jwcid="@Any" href="#" onclick="something();">
> >>>
> >>>This does the exact same thing. I try it with a getLink() method
> because
> >>
> >>I
> >>
> >>>don't really want a link. I don't want a request sent to the server at
> >>>all.
> >>>
> >>>On 11/1/05, Patrick Casey <[EMAIL PROTECTED]> wrote:
> >>>
> >>>>
> >>>>Have you tried the any tag?
> >>>>
> >>>><span jwcid="@Any" element="a" href="ognl:getLink()">
> >>>><span jwcid="@RenderBody" />
> >>>></span>
> >>>>
> >>>>>-----Original Message-----
> >>>>>From: Chris Norris [mailto:[EMAIL PROTECTED]
> >>>>>Sent: Tuesday, November 01, 2005 8:52 AM
> >>>>>To: Tapestry users
> >>>>>Subject: anchor tags
> >>>>>
> >>>>>I feel like quite the noob with this question:
> >>>>>
> >>>>>How do I do anchor tags in Tapestry? My real goal is to have a link
> >>>
> >>>that
> >>>
> >>>>>doesn't go anywhere and just calls a javascript function. This was
> >>>
> >>>what
> >>>
> >>>>I
> >>>>
> >>>>>tried:
> >>>>><a href="#" onclick="someJavascriptFunction();">Click me!</a>
> >>>>>
> >>>>>The url of the page was something like this:
> >>>>>http://localhost:8080/app?page=SomePage&service=page
> >>>>>
> >>>>>I would think that mousing over the link would give me something
> >>
> >>like
> >>
> >>>>>this:
> >>>>>http://localhost:8080/app?page=SomePage&service=page#
> >>>>>
> >>>>>Instead, I got this: http://localhost:8080/#
> >>>>>That just sends me to the home page. This is not the desired
> >>>>>functionality.
> >>>>>This is so basic, and I feel like I'm missing something obvious.
> >>>>>
> >>>>>-Chris
> >>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: [EMAIL PROTECTED]<http://jakarta.apache.org>
> >>>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]<http://jakarta.apache.org>
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]<http://jakarta.apache.org>
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to