Zope ZPT HTML select options from python dictionary

You can use a python dictionary to dynamically build your HTML select option list.
<select name="ship_method" tal:define="products python:{'item1':'Item 1', 'item2': 'Item 2'}">
	<option tal:repeat="product python: products.keys()" tal:attributes="value product;" tal:content="python: products[product]" />
</select>
Posted by
Snippet Viewed 1053 times.

Share your Zope ZPT code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.

 

Submit | Browse

Most Recent zope zpt snippets

Most Viewed