Connecting a Select Field to another field
Sanya Afolabi created the topic: Connecting a Select Field to another field
Hi,
I need to connect a select field to another field in order to fetch data. I have already written the codes but which of the .php files would I edit and what part of the file will I insert the codes?
Regards,
Sanya
Please Log in or Create an account to join the conversation.
- Topic Author
- Sanya Afolabi
- Offline
- Fresh Boarder
- Posts: 16
- Thank you received: 0
9 years 3 months ago
Sanya Afolabi replied the topic: Connecting a Select Field to another field
Here is the code:
if ($row->id == 15) {
$query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE form_id=13 AND element_label=1";
$category_names = $wpdb->get_col($query);
$category_options = '';
foreach ($category_names as $key => $category_name) {
if ($category_name != '') {
$category_options .= '<option onselect="set_select(\'1_option0' . ($key + 1) . '\')" value="' . $category_name . '" id="1_option0' . ($key + 1) . '">' . $category_name . '</option>';
}
}
// var_dump(esc_html($row->form_front));
// $row->form_front = preg_replace('/<select id="1_element15"(.*?)<\/select>/', 'b<select id="1_element15" name="1_element15" style="width: 200px;" onchange="set_select(this)"><option id="1_option0" value="" onselect="set_select(\'1_option0\')" selected="selected">Select value</option>' . $category_options . '</select>', $row->form_front);
$row->form_front = str_replace('<select onchange="set_select(this)" style="width: 200px;" name="1_elementform_id_temp" id="1_elementform_id_temp">', '<select onchange="set_select(this)" style="width: 200px;" name="1_elementform_id_temp" id="1_elementform_id_temp">' . $category_options, $row->form_front);
}
Please Log in or Create an account to join the conversation.
- Topic Author
- Sanya Afolabi
- Offline
- Fresh Boarder
- Posts: 16
- Thank you received: 0
9 years 3 months ago
Support replied the topic: Connecting a Select Field to another field
Dear Sanya,
If this requirement is not very urgent, please make sure to contact us after January 6th. Our development team will be available then and we will be able to discuss this with them.
Thank you.
Best regards,
Web-Dorado team
Joomla extensions ,
Wordpress plugins ,
Drupal modules
Please Log in or Create an account to join the conversation.
9 years 3 months ago