Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

KnowledgeBase


How To: Create a select box with dynamically-generated options
Article TypeHow To
TitleCreate a select box with dynamically-generated options
<i>I have a table, call it "Fruit", which contains rows "Orange", "Pear", and "Apple".<br>
<br>
I'd like to generate a select box which would allow me to select one of the fruit.  When I hit "Submit" I would then be taken to the details page for that specific fruit.  The select box would be populated with "Orange", "Pear" and "Apple", just as a select box belonging to a lookup field located in a different table pointing at the Fruit table would.<br>
<br>
Is there a way to do this without creating a new table that contains a lookup field into the Fruit table?</i><br>
<br>
Create a <a href="/default.view?Topic=ws00008">custom view</a>.
<br>
<span class="smallCode"><pre>
&lt;form method="get" action="/fruitlist.view">
&lt;select name="rowid">
&lt;option value="0" />
&lt;ws:dataregion layout="rawhtml" defaultmode="details"><ws:datasource src="fruit" />
&lt;ws:field name="RowId" displaymodes="never" />
&lt;ws:field name="fruitName" displaymodes="never" />
&lt;option value="#record.rowid#">#record.fruitName#&lt;/option>
&lt;/ws:dataregion>
&lt;/select>
&lt;ws:action />
&lt;/form>
</pre></span>
<br>
Note how I used our #substitution# syntax to populate the value and display text of the options. Also note how I set the layout of my dataregion to "rawhtml".  This prevents the dataregion from trying to format my data for me.<br>
Last ReviewedFebruary 20, 2015 14:08:44

  
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us