Force reloading of a zope form?
I am trying to set up a web site where I can choose different templates to change the style of the site. I store the template name in a browser cookie. All my documents/forms use the cookie to determine which template to render the site with. My selection mechanism is a DTML document named index_html which contains href links. These links call itself (index_html) with a template=n value tacked onto the URL eg: <a href="index_html?template=2">Use Template #2</a> I set the cookie if the "template" value is present when the document is called. The overall flow is: 1: document loads the original template1, based on pre-existing cookie, or default template if none 2: I select a new template with href link 3: link calls the document again (which still loads the original template based on as-yet unchanged cookie) 4: the document sets the cookie value to the new template setting Now I need to reload the form so it can re-read the cookie and use the new template based on my selection. The problem is that I have to reload the form manually, to get the new template to load based on the new cookie setting. If there is a "form reload" method that would solve my problem. Otherwise all I can think to do is have a DTML method for each template I have to set the cookie and then have that method reload the index_html form, where the selection was made from. Hope this makes sense. Can anyone help? Thanks, Patrick Price
Patrick Price wrote:
I am trying to set up a web site where I can choose different templates to change the style of the site. I store the template name in a browser cookie. All my documents/forms use the cookie to determine which template to render the site with.
My selection mechanism is a DTML document named index_html which contains href links. These links call itself (index_html) with a template=n value tacked onto the URL eg: <a href="index_html?template=2">Use Template #2</a>
I set the cookie if the "template" value is present when the document is called.
The overall flow is: 1: document loads the original template1, based on pre-existing cookie, or default template if none 2: I select a new template with href link 3: link calls the document again (which still loads the original template based on as-yet unchanged cookie) 4: the document sets the cookie value to the new template setting
Hi, 1. ok 2. ok 3. wrong: your link should not call the document, but an python-script/dtml-method instead which sets the cookie and... 4. ... redirects to your template -mj
participants (2)
-
Maik Jablonski -
Patrick Price