I'm very confused as to what you are trying to do. Are your users filling out a form? Do you really need the JavaScript? What are you trying to do exactly?
To link between pages, you simply do this (similar to http://web2py.com/book/default/chapter/03#Say-My-Name): === default.py === def a(): return dict() def b(): return dict() === default/a.html === {{extend 'layout.html'}} <a href="{{=URL('b')}}">go to b</a> === default/b.html === {{extend 'layout.html'}} <p>This is b.</p> If users fill out a form, you do something like this: === default.py === def a(): form=FORM('Your name:', INPUT(_name='name', requires=IS_NOT_EMPTY()), INPUT(_type='submit')) if form.accepts(request.vars, session): session.flash = 'form accepted' redirect(URL('b')) elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill the form' return dict(form=form) === default/a.html === {{extend 'layout.html'}} {{=form}} === default/b.html === {{extend 'layout.html'}} <p>This is b.</p>