I have created a dynamic dropdown using advice from this thread:
http://www.chronoengine.com/forums.html?cont=posts&f=12&t=44363&p=194557&hilit=dynamic+dropdown#p194557
However I would like to record 3 values from the selection, could anyone advise how/where is the best way of doing this please?
Here is the Form Code I have used for the dropdown J!1.5/CFv3:
I want to save school_area, school_name and school_code as separate fields on the submitted record.
http://www.chronoengine.com/forums.html?cont=posts&f=12&t=44363&p=194557&hilit=dynamic+dropdown#p194557
However I would like to record 3 values from the selection, could anyone advise how/where is the best way of doing this please?
Here is the Form Code I have used for the dropdown J!1.5/CFv3:
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">School </label>
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `school_name`, `school_area`, `school_code`
FROM `#_chronoforms_schoolslist` ORDER BY `school_area`, `school_name`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select class="cf_inputbox required" id="select_2" size="1" title="" name="school_code">
<option value=''>(please select a school)</option>
<?php
$optgroup = '';
foreach ( $data as $d ) {
$selected = '';
if ( $d->id == $school_name ) {
$selected = "selected='selected'";
}
if ( $d->school_area != $optgroup ) {
if ( $optgroup ) {
echo "</optgroup>";
}
echo "<optgroup label='{$d->school_area}'>";
$optgroup = $d->school_area;
}
echo "<option value='{$d->school_name}' $selected >{$d->school_name} ({$d->school_code})</option>";
}
echo "</optgroup>";
?>
</select>
</div>
<div class="cfclear"> </div>
</div>
I want to save school_area, school_name and school_code as separate fields on the submitted record.
Hi Laus,
You need to make the name into an array name by adding [] and set multiple='multiple'. You may also want to set the size attribute to make it more apparent that multiple selections are OK.
Bob
You need to make the name into an array name by adding [] and set multiple='multiple'. You may also want to set the size attribute to make it more apparent that multiple selections are OK.
<select class="cf_inputbox required" id="select_2" size="4" title="" multple="multiple" name="school_code[]">
You will probably need to set @let ChronoForms handle arrays' to 'Yes' to handle the array result.Bob
This topic is locked and no more replies can be posted.