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


jmRefresh Function Index jmShowLine
jmSelect

The jmSelect function is used for creating a <select> form element in a Jamroom Control Panel form.

form.tpl element name: form_select

  • return: Returns True/False on Success/Error
bool jmSelect (string $text, string $name, array $data, [string $selected = ''], [string $help = ''], [string $javascript = ''], [string $style = false], [array $_actions = false], [string $sub_title = false])
  • string $text: Title for form field - i.e. the string to the left in the Control Panel
  • string $name: Form field "name" value
  • array $data: Array containing key => value pairs for use as the <options> in the select form. This can also be a fully pathed filename containing key|value pairs, one per line.
  • string $selected: Option that will be selected on form load (i.e. existing or default value)
  • string $help: Help Text for the form field
  • string $javascript: Javascript that will be added into the <select> tag
  • string $style: Inline CSS style that will be added into the <select> tag
  • array $_actions: Additional form elements ("actions") that will appear below the input form field
  • string $sub_title: Sub Title that will appear under the title
 Comments
SteveX, 02/11/09 18:40:31:

An example of building your select menu using information from he database:
// Get existing readings by this profile

$req = "SELECT read_id, read_name, read_created

FROM {$jamroom_db['ujStarsReadings']}

WHERE read_author_id = '{$_user['user_band_id']}'

ORDER BY read_created DESC";

$_rt = dbQuery($req,'NUMERIC');

if (isset($_rt[0]) && is_array($_rt[0])) {

foreach ($_rt as $_reading) {

$datex = date('d/m/Y',$_reading['read_created']);

$_sel["{$_reading['read_id']}"] = "{$_reading['read_id']}: {$_reading['read_name']} ({$datex})";

}

}
SteveX, 02/11/09 18:36:35:

If you are not using a text file you can build up your array in your php.

$_sel["Jupiter"] = "Venus discordant to Jupiter";
$_sel["Mars"] = "Venus discordant to Mars";
$_sel["Neptune"] = "Venus discordant to Neptune";
$_sel["Pluto"] = "Venus discordant to Pluto";
$_sel["Saturn"] = "Venus discordant to Saturn";
$_sel["_Uranus"] = "Venus discordant to Uranus";

jmSelect($language['ujStars'][11],'venus_discord',$_sel);
smith.kyle, 01/07/09 00:18:56:

You can pass a file containing your array of <option>'s as the $data param for jmSelect. The file needs to be set up as described here: http://www.jamroom.net/Jamroom4_jr_html_select, where each line contains the option value and text, separated by the | (pipe) symbol (or if no | is found, it will use the same text for both the option value and text). An example is:

jmSelect('Location','band_location',"{$jamroom['jm_dir']}/config/location.txt");
You must be logged in to post a comment
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