Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!

{jr_html_ad} Index {jr_javascript_src}

{jr_html_select}


The {jr_html_select} provides a convenient way to create HTML <select> drop-down list form elements, using data loaded from an external file as the <option> selections in the list.

 

Parameters:

Name Type Required Default Description
name string yes n/a The "name" parameter tells the function what the HTML form name will be for the <select> list created.
options string yes n/a The "options" parameter tells Jamroom the name of the file to use as the <options> (i.e. choices) in the created <select> element.  The file MUST be located in the jamroom/config directory.  See details on the file format below.
selected string no n/a If the "selected" parameter is given, it will contain the item in the <option> list that will be pre-selected on form load.
style string no width: 100%; The "style" option allows for CSS styling to override the default.

 

Options Config File format:

The Options Config file that can be used by the {jr_html_select} template function must be in the proper "format" to be used by the function, so it knows the "value" to be used, as well as the "display" text.  The basic format is:

value|display

The "value" (left side of pipe symbol) is what will be used as the "value" of the option element - i.e. this is what will actually be passed into the target form.  The "display" part is what the user will see in the drop-down list as their choice for that value.  Here's an example Options Config file with 5 entries (saved as "example.cfg" in the jamroom/config directory):

1|One
2|Two
3|Three
4|Four
5|Five


And here's an example of the {jr_html_select} function to use this Options Config file:

{jr_html_select name="the_number" options="example.cfg" selected="2"}


This would produce the following HTML code:

<select class="select" name="the_number" style="width: 100%;">
<option value="1">One</option>
<option value="2" selected="selected">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
<option value="5">Five</option>
</select>

{jr_html_ad} page 127 of 171 {jr_javascript_src}
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Documentation
Support Center
Contact Support
Community Forum
Member Sites
Developers
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network