my code stock.com

bansteatt84

Create a drop-down list box dynamically from database data
by bansteatt84

This example maps the numerical work request priority field to urgency codes. An html form field is used to create a drop-down list box:

Snippet options

Download: Download snippet as create-a-drop-down-list-box-dynamically-from-database-data.txt.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<field> 
    <title>Work Urgency</title> 
    <html> 
        <select class="inputField_box" id="exWorkRequest_urgency" name="exWorkRequest_urgency"> 
            <option value="all" selected="1"><span translatable="true">All</span></option> 
            <option value="emergency"><span translatable="true">Emergency</span></option> 
            <option value="oneDay"><span translatable="true">One Day</span></option> 
            <option value="oneWeek"><span translatable="true">One Week</span></option> 
            <option value="oneMonth"><span translatable="true">One Month</span></option> 
            <option value="eventually"><span translatable="true">No Urgency</span></option> 
        </select> 
    </html> 
</field>
 

Change or retrieve the drop-down list value using JavaScript:

$('exWrFindManage_wr.priority.emergency').checked = true;

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.