Syntax for zpt form and submitting to a dtml method
For learning purposes if I have a zope page tamplate form with a <select> using a dtml method as a action: <form action="dtml_method"> <select name="subject"> <option>Select</option> <option tal:repeat="result here/view_subject" value="" tal:attributes="value result/subject" tal:content="result/subject">data</option> </SELECT> <input type="submit" name="submit" value="submit"> </form> How would I access the value of subject in the dtml_method: <dtml-var subject> The above did not work. Any Ideas?
----- Original Message ----- From: "Laura McCord" <Laura.McCord@doucet-austin.com>
For learning purposes if I have a zope page tamplate form with a <select> using a dtml method as a action:
<form action="dtml_method"> <select name="subject"> <option>Select</option> <option tal:repeat="result here/view_subject" value="" tal:attributes="value result/subject" tal:content="result/subject">data</option> </SELECT> <input type="submit" name="submit" value="submit"> </form>
How would I access the value of subject in the dtml_method:
<dtml-var subject>
The above did not work. Any Ideas?
Try: <dtml-var "REQUEST.get('subject', 'None')"> or <dtml-var "REQUEST['subject']"> Jonathan
Hi Laura, Am Di, den 21.09.2004 schrieb Laura McCord um 22:16:
For learning purposes if I have a zope page tamplate form with a <select> using a dtml method as a action:
<form action="dtml_method"> <select name="subject"> <option>Select</option> <option tal:repeat="result here/view_subject" value="" tal:attributes="value result/subject" tal:content="result/subject">data</option> </SELECT> <input type="submit" name="submit" value="submit"> </form>
How would I access the value of subject in the dtml_method:
<dtml-var subject>
The above did not work. Any Ideas?
"Did not work" does not help. The code is ok, meaning you should see the value when you actually select something (Note your first option has no value) If you are unsure just use something like this: DTML-Method: <dtml-var REQUEST> ZPT: <span tal:replace="structure request">Request</span> Python Script: return context.REQUEST to render the contents of Request as HTML. DTML can make trouble if you have other elements in the namespace somewhere which have the same name. So the above code might access a property or another object with id "subject". Sometimes you see this when you look at the pages source in the browser, since generic display of objects in python results in something like <foobar object at 0x23492889> Note the < > are similar to HTML tags so most browsers dont show this. The source view will make it visible. Regards Tino
participants (3)
-
Jonathan Hobbs -
Laura McCord -
Tino Wildenhain