Title: Possible code error related to extra fields
Last modified: August 21, 2016

---

# Possible code error related to extra fields

 *  [pwsolutions](https://wordpress.org/support/users/pwsolutions/)
 * (@pwsolutions)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/possible-code-error-related-to-extra-fields/)
 * On one system that I have this plugin set up on, I’m seeing debug messages for
   some forms.
 * Looking over the code, it appears that GFSalesforceWebToLead::push is looks like
   fieldtemp is not always an array when it hits the foreach block.
 * E.g. foreach( $fieldtemp as $inputKey => $input ) …
 * I’m expecting that $_POST[“input_” . $field[“id”]]; does not have an array as
   a value in all cases. ( e.g. perhaps the code should reference $field[“input_”.
   $field[“id”]] instead? )
 * Anywise, just a heads up as this might be causing other issues.
 * [http://wordpress.org/extend/plugins/gravity-forms-salesforce/](http://wordpress.org/extend/plugins/gravity-forms-salesforce/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [pwsolutions](https://wordpress.org/support/users/pwsolutions/)
 * (@pwsolutions)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/possible-code-error-related-to-extra-fields/#post-3885802)
 * Oh right, while I’m using 3.5.1 of wordpress, I’m using the current latest version
   of both Gravity Forms ( 1.7.6 ) and GF Sales Force Web To Lead ( 2.2.6 ).
 *  Thread Starter [pwsolutions](https://wordpress.org/support/users/pwsolutions/)
 * (@pwsolutions)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/possible-code-error-related-to-extra-fields/#post-3885946)
 * Alright, after some more testing ( and a class to let me see everything that 
   is happening during a gravity form submission ), I’ve found the following bugs,
   both in the salesforce.php file.
 * Minor Bug:
 * GFSalesForceWebToLead::push ( Line 599 ):
 *     ```
       } else if($label == 'street') {
           $data['street'] .= $value."\n";
       }
       ```
   
 * This should test to see if it exists before just appending to it ( just like 
   the code does above on line 559 ).
 * Larger Bug ( prevents choices from getting into salesforce ):
 * GFSalesForceWebToLead::push ( Line 526 ):
 *     ```
       if ( is_array($field["inputs"])) {
          $fieldtemp = $field["inputs"];
       }
        else {
          $fieldtemp = $_POST["input_" . $field["id"]]; # BUG
          $multi_input = false;
          $label = self::getLabel($field["label"], $field);
       }
       ```
   
 * The line marked bug should be creating fieldtemp as an array, not a value. It
   fails on line 533 as 533 assumes fieldtemp is an array.
 * Update the marked line:
 *     ```
       $fieldtemp = array( $_POST["input_" . $field["id"]] );
       ```
   
 * That seems to fix the problem.
 * Anywise, thanks for looking!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Possible code error related to extra fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gravity-forms-salesforce_fbfdff.svg)
 * [Gravity Forms Salesforce Add-on](https://wordpress.org/plugins/gravity-forms-salesforce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-salesforce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-salesforce/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-salesforce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-salesforce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-salesforce/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [pwsolutions](https://wordpress.org/support/users/pwsolutions/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/possible-code-error-related-to-extra-fields/#post-3885946)
 * Status: not resolved