Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML by Field Name #10

Closed
RSpecianJr opened this issue Apr 28, 2015 · 6 comments
Closed

XML by Field Name #10

RSpecianJr opened this issue Apr 28, 2015 · 6 comments

Comments

@RSpecianJr
Copy link

Hey Zaus,

I've run into another small problem again. I'm working on getting multiple forms set up to send XML data based on forms origin page. It requires me to have a form for each page, but the XML submission code should be static.

Using Ninja Forms, I duplicate a form with identical field names (but different they have different field IDs). The issue I'm having is that I need to map the field names to the XML fields, but it only takes the field ID.

I've gone through the process for zaus/forms-3rdparty-integration#35 and it works on the form submission but does not translate to the XML. Must be missing something somewhere.

Thanks,

Robert

@zaus
Copy link
Owner

zaus commented Apr 30, 2015

What's your debug email look like?

@RSpecianJr
Copy link
Author

Hey Zaus,

Thanks for the quick reply as always. This is a killer plugin and I've got some great mileage out of it thus far. I've *'d out information that is sensitive. I'll play with it a little more after I get some sleep, but the issue is that it isn't matching the name of the field to the ID of the active form.

Thanks,

Robert

*** Service ***
Array
(
    [name] => Tenstreet
    [url] => https://dashboard.tenstreet.com/post
    [forms] => Array
        (
            [0] => njn_8
            [1] => njn_6
            [2] => njn_10
            [3] => njn_11
            [4] => njn_13
            [5] => njn_14
        )

    [success] =>
    [failure] =>
    [timeout] => 10
    [hook] => true
    [as-xpost] => true
    [xpost-wrapper] => TenstreetData
    [xpost-header] =>
    [mapping] => Array
        (
            [0] => Array
                (
                    [val] => 1
                    [lbl] => Mode
                    [src] => Prod
                    [3rd] => Mode
                )

            [1] => Array
                (
                    [val] => 1
                    [lbl] => Source
                    [src] => RightPost
                    [3rd] => Source
                )

            [2] => Array
                (
                    [val] => 1
                    [lbl] => ClientId
                    [src] => **
                    [3rd] => Authentication/ClientId
                )

            [3] => Array
                (
                    [val] => 1
                    [lbl] => Password
                    [src] => ******************************
                    [3rd] => Authentication/Password
                )

            [4] => Array
                (
                    [val] => 1
                    [lbl] => Service
                    [src] => subject_upload
                    [3rd] => Authentication/Service
                )

            [5] => Array
                (
                    [val] => 1
                    [lbl] => CompanyId
                    [src] => ***
                    [3rd] => CompanyId
                )

            [6] => Array
                (
                    [val] => 1
                    [lbl] => CompanyName
                    [src] => *******
                    [3rd] => CompanyName
                )

            [7] => Array
                (
                    [lbl] => First Name
                    [src] => First Name
                    [3rd] => PersonalData/PersonName/GivenName
                )

            [8] => Array
                (
                    [lbl] => Last Name
                    [src] => Last Name
                    [3rd] => PersonalData/PersonName/FamilyName
                )

            [9] => Array
                (
                    [lbl] => Email Address
                    [src] => Email
                    [3rd] => PersonalData/ContactData/InternetEmailAddress
                )

            [10] => Array
                (
                    [lbl] => Phone Number
                    [src] => Phone Number
                    [3rd] => PersonalData/ContactData/PrimaryPhone
                )

            [11] => Array
                (
                    [lbl] => City
                    [src] => City
                    [3rd] => PersonalData/PostalAddress/Municipality
                )

            [12] => Array
                (
                    [lbl] => State
                    [src] => State
                    [3rd] => PersonalData/PostalAddress/Region
                )

            [13] => Array
                (
                    [lbl] => Zip
                    [src] => Zip / Post Code
                    [3rd] => PersonalData/PostalAddress/PostalCode
                )

            [14] => Array
                (
                    [lbl] => Referrer
                    [src] => Hidden Field
                    [3rd] => ApplicationData/AppReferrer
                )

        )

    [separator] =>
)

*** Post (Form) ***
*************************************
Array
(
    [45] => dave
    [46] => test
    [47] => ************
    [48] => (555) 555-5555
    [49] => Cosby
    [50] => TN
    [51] => 37722
    [52] =>
    [53] => Indeed OO
)

*** Post (to Service) ***
Array
(
    [timeout] => 10
    [body] => <?xml version="1.0"?>
<TenstreetData><Authentication><ClientId>**</ClientId><Password>******************************</Password><Service>subject_upload</Service></Authentication><Mode>Prod</Mode><Source>RightPost</Source><CompanyId>***</CompanyId><CompanyName>******</CompanyName></TenstreetData>

    [headers] => Array
        (
            [Content-Type] => application/xml
        )

)

*** Response ***
Array
(
    [headers] => Array
        (
            [date] => Tue, 28 Apr 2015 14:32:02 GMT
            [server] => Apache
            [content-length] => 474
            [connection] => close
            [content-type] => text/html; charset=UTF-8
        )

    [body] => <?xml version="1.0" encoding="UTF-8"?>
<TenstreetResponse><Version>1.1</Version><SourceIpAddress>***.***.***.***</SourceIpAddress><CompanyPostedToId>***</CompanyPostedToId><CompanyPostedToName>*******</CompanyPostedToName><DateTime>2015-04-28 9:32:02</DateTime><Mode>PROD</Mode><SSN></SSN><DriverId></DriverId><DriverName> </DriverName><Status>REJECTED</Status><Description>Error 1: First Name is required.  Error 2: Last Name is required.  </Description></TenstreetResponse>

@zaus
Copy link
Owner

zaus commented May 1, 2015

So it's only setting the 'Is Value' mappings, but not extracting your named fields. Are you saying that it works if you turn off xpost? If so, I wonder if the problem might be the priority of the xpost hook conflicting with your hook? Any chance you can share your code?

@RSpecianJr
Copy link
Author

Hey Zaus,

Yea, in the data above, you can see that the fields work for third party integration, they just dont translate over to xpost. I haven't done any modifications to the code, so the code should be what you can install from the wordpress plugins page. If you want me to upload it I can.

I don't have custom hooks.

Thanks,

Robert

@zaus
Copy link
Owner

zaus commented May 1, 2015

Sorry, maybe I misunderstood when you referenced the 'name remap' issue:

I've gone through the process for zaus/forms-3rdparty-integration#35 and it works on the form submission but does not translate to the XML.

I thought you had written something to get it to map on name vs id. If you haven't, then that's why it's not working -- all of your src fields should correspond to something in the "Post (Form)" section of the debug email, which are numerical ids for Ninja Forms, not field names like you currently have mapped.

I originally wrote this plugin for Contact Form 7, where you have control over the field id/names, which makes it really easy to share services across forms (since you can name all the fields the same). But when I added support for Gravity Forms and Ninja Forms, everyone found out that they're not as great in that regard. Issue 35 is a wishlist to address that, but I haven't actually done anything for it.

zaus added a commit to zaus/forms-3rdparty-integration that referenced this issue Nov 19, 2015
@zaus
Copy link
Owner

zaus commented Nov 19, 2015

Implemented as native functionality per referenced commit v1.6.6 to core plugin F3i.

@zaus zaus closed this as completed Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants