Put the jquery stuff in a file and include it in any view where you want to call the dialog function.
The document.write just adds a container for the dialog box. You could just as easily put the html in the page directly but I put it here so that it is all together in one js file which can be included anywhere. Yes you just do _onclick="javascript:dialog({{=_link}}) Not sure how you would get it to work with auth.requires_login(). If you are on a completely different website then there is no way of showing a dialog with the original page underneath. So you would probably need to replace the login view with another view that then calls dialog(url). web2py_ajax_page is a function in web2py.js. I don't think it is documented but you can read the code to see what it is doing. It is quite short. I am not sure about the open and close so you will need to experiment. I think the open will be just before the return at the end of user. The close may not be necessary as the dialog will close anyway if you navigate to another page. On Jan 18, 5:28 pm, Annet <anneve...@googlemail.com> wrote: > Hi, > > Thanks for your reply, I am not sure I completely understand your > solution. > > In which file(s) do I put the following lines of code: > > > // create dialogbox > > document.write("<div id='dialogdiv' style='display:none'></div>") > > $(document).ready(function(){ > > $('#dialogdiv').dialog({autoOpen : false, modal : false, width : > > 'auto'}); > > > }) > > > // open url in dialog box > > function dialog(url) { > > web2py_ajax_page("get", url, null , 'dialogdiv')} > > Does document.write(...) replace this part of your previous reply: > > <div id="web2py_user_form" style='display:none'> > > why document.write()? does it create sort of a container for the > entire default/user.html view? > > > ... and then you can just replace any url with > > dialog(url) and it will show up in a dialog. > > You mean replace this: href="{{=_link}}" in the auth_menu rendering > with something like: > > _onclick="javascript:dialog({{=_link}}) > > What about web2py's internal behaviour of opening the login function > whenever a function is decorated @auth.requires_login() > > I searched the book for web2py_ajax_page but could find anything, > where is this functionality documented? > > Kind regards, > > Annet.