I'm trying to find info on how to have the values selected in my Multiple Drop down list once the data is retrieved from the tables
I have a multi drop down called Category
When I load the data back to the form with the db record loader, I put in arrayfields sets Category and Array Separators as , . It loads the dropdown list, but doesn't select those fields that were stored in the tables.
I'm using Joomla 1.7 and the new ChronoForms V4
I have a multi drop down called Category
When I load the data back to the form with the db record loader, I put in arrayfields sets Category and Array Separators as , . It loads the dropdown list, but doesn't select those fields that were stored in the tables.
I'm using Joomla 1.7 and the new ChronoForms V4
Please ignore - I found the bug fix in the forum and corrected
This is the line I added at line 165
// added explode
$field_value = explode(',', $data[$field_name]);
Here is where the code is located between
foreach($matches_options[0] as $matches_option){
$pattern_value = '/value=("|\')(.*?)("|\')/i';
preg_match($pattern_value, $matches_option, $matches_value);
$optionmatch = $matches_option;
//----------------------
// added explode -
$field_value = explode(',', $data[$field_name]);
//--------------------------------
if(in_array($matches_value[2], $field_value)){
$optionmatch = preg_replace('/<option/i', '<option selected="selected"', $matches_option);
}
$selectmatch = str_replace($matches_option, $optionmatch, $selectmatch);}
This is the line I added at line 165
// added explode
$field_value = explode(',', $data[$field_name]);
Here is where the code is located between
foreach($matches_options[0] as $matches_option){
$pattern_value = '/value=("|\')(.*?)("|\')/i';
preg_match($pattern_value, $matches_option, $matches_value);
$optionmatch = $matches_option;
//----------------------
// added explode -
$field_value = explode(',', $data[$field_name]);
//--------------------------------
if(in_array($matches_value[2], $field_value)){
$optionmatch = preg_replace('/<option/i', '<option selected="selected"', $matches_option);
}
$selectmatch = str_replace($matches_option, $optionmatch, $selectmatch);}
This topic is locked and no more replies can be posted.