Support » Plugin: Forms: 3rd-Party Integration » Check Box and Radio Button ‘Array’ syntax

  • All text fields and drop down lists successfully inputs the data into salesforce.

    Having trouble with radio buttons or checkboxes only coming through as ‘Array’. So I tried changing the separator from , to [] and also [#]. The debug email suggests the information was posted to 3rd party service, but nothing made it into the ‘description’ field, just the first name, last name, phone, email, lead type and the rest ignored.

    Can the syntax of the form field be something like ‘vehicle-use[0]’ or something to carry the value in? I tried this, but then no injection of data is made at all.

    I’ll add the debug code below.

Viewing 3 replies - 1 through 3 (of 3 total)
  • *** Service ***
    Array
    (
       [name] => salesforce:responsive-car-loan-quote
       [url] => https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8
       [forms] => Array
           (
               [0] => cf7_1012
           )
    
       [success] => 
       [failure] => 
       [timeout] => 
       [mapping] => Array
           (
               [0] => Array
                   (
                       [val] => 1
                       [lbl] => Our Database
                       [src] => 00deleted00
                       [3rd] => oid
                   )
    
               [1] => Array
                   (
                       [val] => 1
                       [lbl] => lead_source
                       [src] => Website Lead
                       [3rd] => 00N1N00000FKBzP
                   )
    
               [2] => Array
                   (
                       [val] => 1
                       [lbl] => Lead Source3
                       [src] => Website Lead
                       [3rd] => lead_source
                   )
    
               [3] => Array
                   (
                       [lbl] => [First-Name]
                       [src] => First-Name
                       [3rd] => first_name
                   )
    
               [4] => Array
                   (
                       [lbl] => Last-Name
                       [src] => Last-Name
                       [3rd] => last_name
                   )
    
               [5] => Array
                   (
                       [lbl] => your-email
                       [src] => your-email
                       [3rd] => email
                   )
    
               [6] => Array
                   (
                       [lbl] => phone-996
                       [src] => phone-996
                       [3rd] => mobile
                   )
    
               [7] => Array
                   (
                       [lbl] => purchase-price-996
                       [src] => purchase-price-996
                       [3rd] => description
                   )
    
               [8] => Array
                   (
                       [lbl] => [make-238]
                       [src] => make-238
                       [3rd] => description
                   )
    
               [9] => Array
                   (
                       [lbl] => model-238
                       [src] => model-238
                       [3rd] => description
                   )
    
               [10] => Array
                   (
                       [lbl] => Year
                       [src] => date-944
                       [3rd] => description
                   )
    
               [11] => Array
                   (
                       [lbl] => purchasing-from
                       [src] => purchasing-from
                       [3rd] => description
                   )
    
               [12] => Array
                   (
                       [lbl] => vehicle-use
                       [src] => vehicle-use
                       [3rd] => description
                   )
    
               [13] => Array
                   (
                       [lbl] => Property Owner
                       [src] => property-owner
                       [3rd] => description
                   )
    
               [14] => Array
                   (
                       [lbl] => [your-message]
                       [src] => your-message
                       [3rd] => description
                   )
    
           )
    
    )
    
    *** Post (Form) ***
    http://www.thebrokerteam.com.au/wp-json/contact-form-7/v1/contact-forms/1012/feedback
    Array
    (
       [_wpcf7] => 1012
       [_wpcf7_version] => 4.9.1
       [_wpcf7_locale] => en
       [_wpcf7_unit_tag] => wpcf7-f1012-p670-o1
       [_wpcf7_container_post] => 670
       [purchase-price-996] => $2500
       [make-238] => nissan
       [model-238] => patrol
       [date-944] => 1967
       [purchasing-from] => Array
           (
               [0] => Private Purchase
           )
    
       [vehicle-use] => Array
           (
               [0] => Personal Use
           )
    
       [your-message] => msg5
       [First-Name] => nick
       [Last-Name] => quote5
       [your-email] => info@deleted.com.au
       [phone-996] => 123456789
       [property-owner] => Array
           (
               [0] => No
           )
    
       [g-recaptcha-response] => 03AO6mBfxBk3whSGaeag_zrTuj734hMLZ1fU61__R4lGRT8632xpy7SpeREXJvOfsTa5PcMW-aZ-IsRZVLXWT6yFVVoNzKg2yPboEd9c1KtFcwHr3uoyTVmnFxm6HK6kHwTF_nIGpng-qFrQX0E4jYwn-oJC-VcizwlCcjYQIzkghmxTKd6Txb8TvZCIcxLiTM7wEXJM4SD1976RsqB1WLrBn92C6YO1r4HQSH6XWea2aNVzcNO5lW0xf76bo2NSDv1JlQ6LCXMoCu-KYPje1jzhNA6C_giHQFfyg2W-J7v_tY8IJbxniB7eLnkupzJX-m3dtDHKKMj3RHVuC_osVT_ELgTQNPwcbueA
       [referer-page] => http://www.thebrokerteam.com.au/home-loans/buying-a-property/
    )
    
    *** Post (to Service) ***
    Array
    (
       [timeout] => 10
       [body] => Array
           (
               [oid] => 00deleted00
               [00N1N00000FKBzP] => Website Lead
               [lead_source] => Website Lead
               [first_name] => nick
               [last_name] => quote5
               [email] => info@deleted.com.au
               [mobile] => 123456789
               [description] => Array
                   (
                       [0] => $2500
                       [1] => nissan
                       [2] => patrol
                       [3] => 1967
                       [4] => Array
                           (
                               [0] => Private Purchase
                           )
    
                       [5] => Array
                           (
                               [0] => Personal Use
                           )
    
                       [6] => Array
                           (
                               [0] => No
                           )
    
                       [7] => msg5
                   )
    
           )
    
    )
    
    *** Response ***
    WP_HTTP_Requests_Response Object
    (
       [response:protected] => Requests_Response Object
           (
               [body] => 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <meta http-equiv="Refresh" content="0; URL=https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
    </head>
    <script>if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'); }  else if (window.location.replace){ window.location.replace('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8');} else {;window.location.href ='https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';} </script></html>
    
               [raw] => HTTP/1.1 200 OK
    Date: Fri, 01 Dec 2017 07:02:52 GMT
    Cache-Control: private
    Set-Cookie: BrowserId=HHnXo783TmCSUjtcYCEDzw;Path=/;Domain=.salesforce.com;Expires=Tue, 30-Jan-2018 07:02:52 GMT;Max-Age=5184000
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Content-Type: text/html;charset=UTF-8
    Vary: Accept-Encoding
    Content-Encoding: gzip
    Transfer-Encoding: chunked
    Connection: close
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <meta http-equiv="Refresh" content="0; URL=https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
    </head>
    <script>if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'); }  else if (window.location.replace){ window.location.replace('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8');} else {;window.location.href ='https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';} </script></html>
    
               [headers] => Requests_Response_Headers Object
                   (
                       [data:protected] => Array
                           (
                               [date] => Array
                                   (
                                       [0] => Fri, 01 Dec 2017 07:02:52 GMT
                                   )
    
                               [cache-control] => Array
                                   (
                                       [0] => private
                                   )
    
                               [set-cookie] => Array
                                   (
                                       [0] => BrowserId=HHnXo783TmCSUjtcYCEDzw;Path=/;Domain=.salesforce.com;Expires=Tue, 30-Jan-2018 07:02:52 GMT;Max-Age=5184000
                                   )
    
                               [expires] => Array
                                   (
                                       [0] => Thu, 01 Jan 1970 00:00:00 GMT
                                   )
    
                               [content-type] => Array
                                   (
                                       [0] => text/html;charset=UTF-8
                                   )
    
                               [vary] => Array
                                   (
                                       [0] => Accept-Encoding
                                   )
    
                               [content-encoding] => Array
                                   (
                                       [0] => gzip
                                   )
    
                           )
    
                   )
    
               [status_code] => 200
               [protocol_version] => 1.1
               [success] => 1
               [redirects] => 0
               [url] => Requests_IRI Object
                   (
                       [scheme:protected] => https
                       [iuserinfo:protected] => 
                       [ihost:protected] => www.salesforce.com
                       [port:protected] => 
                       [ipath:protected] => /servlet/servlet.WebToLead
                       [iquery:protected] => encoding=UTF-8
                       [ifragment:protected] => 
                       [normalization:protected] => Array
                           (
                               [acap] => Array
                                   (
                                       [port] => 674
                                   )
    
                               [dict] => Array
                                   (
                                       [port] => 2628
                                   )
    
                               [file] => Array
                                   (
                                       [ihost] => localhost
                                   )
    
                               [http] => Array
                                   (
                                       [port] => 80
                                   )
    
                               [https] => Array
                                   (
                                       [port] => 443
                                   )
    
                           )
    
                   )
    
               [history] => Array
                   (
                   )
    
               [cookies] => Requests_Cookie_Jar Object
                   (
                       [cookies:protected] => Array
                           (
                               [BrowserId] => Requests_Cookie Object
                                   (
                                       [name] => BrowserId
                                       [value] => HHnXo783TmCSUjtcYCEDzw
                                       [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                           (
                                               [data:protected] => Array
                                                   (
                                                       [path] => /
                                                       [domain] => salesforce.com
                                                       [expires] => 1517295772
                                                       [max-age] => 1517295772
                                                   )
    
                                           )
    
                                       [flags] => Array
                                           (
                                               [creation] => 1512111772
                                               [last-access] => 1512111772
                                               [persistent] => 
                                               [host-only] => 
                                           )
    
                                       [reference_time] => 1512111772
                                   )
    
                           )
    
                   )
    
           )
    
       [filename:protected] => 
       [data] => 
       [headers] => 
       [status] => 
    )

    Any help would be fantastic

    Plugin Author zaus

    (@zaus)

    That’s a weird one. How do you want it to be passed? If you leave the separator blank or use a space, it should concatenate the array values to a single text string — I’m guessing the debug example you posted was from using []? What does it look like if left blank?

    Relevant code where separator is used:
    https://github.com/zaus/forms-3rdparty-integration/blob/master/forms-3rdparty-integration.php#L571

    If it’s the doubly-nested array values like “purchasing-from” and “vehicle-use” that are screwing it up, you might try changing the field types in CF7 to a dropdown or something else so they only provide one value like “make-238”?

    Failing all that, you can write a quick hook to reformat that one value in the post using either hook …service_filter_post (before the separator processing) or …service_filter_args.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Check Box and Radio Button ‘Array’ syntax’ is closed to new replies.