Zope ZPT Select box options looped over dictionary

Display a select box who's label and values are based on keys and values in a dictionary.
<div class="field" 
     tal:define="options python:{'Sales': '[email protected]', 
				 'Customer Service': '[email protected]', 
				 'Claims' : '[email protected]'">
	<label for="sendto">Who</label>
	<select name="sendto" id="sendto">
	<tal:loop repeat="option python:options.keys()">
		<option tal:attributes="value python: options[option]; 
		  selected python: test(request.get('sendto','') == options[option], 'true','')" 
		  tal:content="option" />
Snippet Viewed 1949 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