[ZPT] How to pass values from a form to a page template?

vaibhav uprety uprety_vaibhav at yahoo.co.in
Fri Apr 30 01:37:25 EDT 2004


Hi,

I have made a DTML document storing the name of some books which i have to post to a Page template here is the coding for the DTML Document.

<html>
<body bgcolor="#0099CC">
<h1>Assign Privileges To book</h1>
<form method=POST action="access2">
  PLONE BOOK<select size="1" name="attr1">
  <option value="CAD">CAD</option>
  <option value="BARC">BARC</option>
  <option value="ADA">ADA</option>
  </select>
  <input type="submit" value="Assign Roles">
  <input type="reset" value="Reset"></p>
</form>

in this DTML Document  

1. the options specified by the select tag are some of the roles defined by me.
2. access2 is the Page template to which this value is to be passed

here is the code for access2
-----------------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
      lang="en-US"
      metal:use-macro="here/main_template/macros/master">

<body>
<div metal:fill-slot="main" tal:define="user request/form/attr1">
<a tal:condition="python:context.portal_membership.getAuthenticatedMember().has_role('user')" href="./plonebook">view pdf</a> 
     
</div>
       
</body>
</html>
----------------------------------------------------------------------------------------------------------

now i want that the link to the book to be displayed by the page template on the basis of value of 'attr1' passed to it by the form i.e the python conditional statement which checks for role should decide the role based on the value passed to it. 
 
But here comes the problem since i log in using the login_form, it although authenticates the user but when it redirects to access2 the value of 'attr1' becomes undefined as login_form posts no such value to access2
 
Please help me to correct this problem.
Thanks in advance

Vaibhav 

  


Yahoo! India Matrimony: Find your partner online.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zpt/attachments/20040430/3c389356/attachment.html


More information about the ZPT mailing list