WordPress.org

Forums

Gravity Forms Salesforce Add-on
Populating Multi Picklists through checkboxes (2 posts)

  1. valerio_cas
    Member
    Posted 1 year ago #

    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.

    1. Add the code to convert commas to semicolons, as in the FAQ section.
    2. Add a select box to your form, with the same values as your checkboxes.
    3. Hide this with CSS
    4. 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;
    }

    https://wordpress.org/plugins/gravity-forms-salesforce/

  2. Jason
    Member
    Posted 1 year ago #

    Thanks valerio_cas, this is exactly what I'm looking for.

    However, I can't seem to get it to work.

    I've got my checkbox fields which is "input_1_12" and then I have my hidden multiselect field which is "input_1_50".

    I tried emulating your code with my fields, but I'm not sure where you got your input_6_2 from. Anyway, this is my code below:

    add_action("gform_pre_submission", "mysite_pre_submission_handler");
    function mysite_pre_submission_handler($form){
    
        $temp = array();
    
        if ($_POST['input_1_12'])
            $temp[] = $_POST['input_1_12'];
    
        if ($_POST['input_1_13'])
            $temp[] = $_POST['input_1_13'];
    
        $_POST['input_50'] = $temp;
    }

    I'm trying to just pass on the checkbox fields to the multi-select. Let me know.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Gravity Forms Salesforce Add-on
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.