title: web2py - Dropdown menu
body: <p>I'm trying to have a dropdown menu for the user to select the database table. I have defined few tables in db.py and I want the user the to select a particular table from a dropdown menu and insert entries. Right now I use SQLFORM:</p>
  
  <pre><code>def index():
      form=SQLFORM(db.selectedtable)  #want to change the table name#
      if form.process().accepted:
         response.flash = 'form accepted'
      elif form.errors:
         response.flash = 'form has errors'
      else:
         response.flash = 'please fill out the form'
      return dict(form=form)
  </code></pre>
  
  <p>I need the user to select 'selectedtable' value from a dropdown list that shows all the available tables in the DB. I do not necessarily want to retrieve the table values from DB. I am OK with defining a list with the available tables and the dropdown menu can pull the table names from that list.
  So far I only found IS_IN_DB to automatically create a dropdown and PluginDropdown() but that does not serve my purpose. If soemebody can direct me to the proper way of handling this task I'd be really thankful.</p>
  
  <p>Regards.</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>After Anthony's suggession I tried the following with , as I'm not that familiar with JS.</p>
  
  <pre><code>{{extend 'layout.html'}}
  {{select='NONE'}}
  
  &lt;form&gt;    
  &lt;select&gt;
  {{for item in TOOLS:}}
  &lt;option value="{{select=item}}"&gt;{{=item}}&lt;/option&gt;{{pass}}
  &lt;/select&gt;
   &lt;input type="submit" value="Go!"/&gt;
  &lt;/form&gt;
  
  &lt;h2&gt;Input form&lt;/h2&gt;
  {{=form}}
  
  &lt;h2&gt;{{=select}}&lt;/h2&gt;
  </code></pre>
  
  <p>As you might see this doesn't work properly. What I tried to do is to get the user chose value to 'select' variable. But it doesn't work. It always gets the last element in ITEMS (this list is defined in db.py). My next option would be to be call another controller function, passing the user selected value as an argument. Then it can prepare the form with the passed value and send to a view to display </p>
  
  <pre><code>&lt;h2&gt;Input form&lt;/h2&gt;
      {{=form}}
  </code></pre>
  
  <p>But I'm not sure how I can assign the user chosen value to an argument and then call another controller function with that arugument value.
  If you have any suggestion how I can modify this to get the user chosen value thats very much appreciated. Thank you.</p>