I might have missed something. Are you trying to move the viewport to the 
element with the id after the hash?

If so, would you be able to use:
   document.location.hash = "tabs=2";

Does that work?

On Wednesday, March 21, 2012 5:39:08 PM UTC-4, Cliff wrote:
>
> Thanks, Jonathan.  I appreciate the hint. 
>
> For anyone interested, there are a few more things you have to do. 
> If you just add anchor='tabs-2' to URL(), it renders /bla/edit/ 
> 5#tabs-2. 
>
> Not an invalid request, but it doesn't get you to the anchor, either. 
>
> So do something like URL(bla, args=[request.args(0), ''], 
> anchor='tabs-2'). 
> That renders bla/edit/5//#tabs-2.  Note the two slashes.  This works 
> but 
> only one time, even if you create an observer by using live(). 
>
> A call to location.reload() fixes that problem. 
>
> Here is the complete function.  It is kind of slow. 
> $('#clickme').live('click', function(){ 
>             alert('hi');  // make sure we are firing on click 
>            window.location.href = "{{=URL('edit', 
> anchor='tabs-2',args=[str(request.args(0))])}}"; 
>            location.reload; 
>         }); 
>
> On Mar 21, 4:04 pm, Jonathan Lundell <[email protected]> wrote: 
> > On Mar 21, 2012, at 12:49 PM, Cliff wrote: 
> > 
> > 
> > 
> > > Here is a snippet of javascript code: 
> > > window.location.href = "{{=URL('edit', args=[request.args(0), 
> > > '#tabs-2'])}}"; 
> > 
> > > Notice the '#' in the args list. 
> > 
> > > URL persists in rendering the '#' as %23, which causes Web2py to throw 
> > > an 'Invalid Request' page. 
> > 
> > > I have tried using XML to preserve the pound sign, but to no avail. 
> > 
> > > How can I work around this? 
> > 
> > Try adding the argument anchor='tabs-2' to URL().

Reply via email to