Populating Multi Picklists through checkboxes
-
I thought I’d share my solution for this in case it helps anybody, even though it’s a bit hacky. If someone has a better solution, please let me know.
The plugin maps GF multiselect to SalesForce Picklist (Multi-Select), but my client wanted to use checkboxes.
- Add the code to convert commas to semicolons, as in the FAQ section.
- Add a select box to your form, with the same values as your checkboxes.
- Hide this with CSS
- Add this code to populate the select box values with the checkbox values on submit.
In this case, my checkbox field ID was 6, and my hidden select box ID was 10:
add_action("gform_pre_submission", "mysite_pre_submission_handler"); function mysite_pre_submission_handler($form){ $temp = array(); if ($_POST['input_6_1']) $temp[] = $_POST['input_6_1']; if ($_POST['input_6_2']) $temp[] = $_POST['input_6_2']; $_POST['input_10'] = $temp; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Populating Multi Picklists through checkboxes’ is closed to new replies.