On 13/10/10 16:17, Torbjorn wrote: > Thanks for the replies. > > Jonathan: No I'm not stuck to JQuery, I will consider dojango. Thanks >
[Another thing to be aware of is dajaxproject.com] > <li><a href="{% url newsite.mealplan.courseviews.categories %}">Third</a></li> Okay, so you _are_ using the tabs' ajax mode. > That works, but when I choose tab Third and post a form (django) I get > to the "original" page without tabs by rendering the category > template. Because the browser client is still doing a normal form post and therefore it shows the server's response as a whole new toplevel page, presumably. > Here is the code for that > > return render_to_response("categories.html", > {"categories":categories, 'form':form}) > > So, how should I rewrite this so the third tab is shown instead of the > template only? Rewrite newsite.mealplan.courseviews.categories the django view ? No need to do much there, at least if you're going with the method I suggested (using the jquery-form plugin), maybe some small changes to the categories.html django template (only a html fragment, it's one place you could put the ajaxification script since jquery takes pains Please take a close look at this example: http://jquery.malsup.com/form/#html As you can see, you can use the plugin to hijack a form submission into an ajax [xmlhttp]request, and then put the server's (django's) response back into a particular place in the document (right back into the relevant tab being an obvious choice!) There certainly are a number of other approaches possible, but that one is a one-liner or close enough and, well, you have already gone down the ajax path. > Is cookies the solution to that? cookies were relevant if you were re-rendering the whole of base.html with the tabs in a view that you'd redirected to or something and wanted the client to remember to switch to the tab it had used last time it showed the response. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.