Please explain address field IDs logic

  • Philip_Thorne
    Asked on September 5, 2024 at 7:37 PM

    I'm interested in making an integration to JotForms. A customer has a form with an Address widget. If I look at the form in the designer, I see that the following options are selected under Field Options:

    Street Address

    Street Address 2

    City

    State

    Postal/Zip code


    However, if I ask for the fields using your API to get the form questions, I get the following result for the address field:

        "4": {

          "countryDropdownDefaultText": "Please Select",

          "customCountryDropdown": "No",

          "hasAutocomplete": "No",

          "labelAlign": "Auto",

          "name": "address4",

          "order": "4",

          "qid": "4",

          "required": "Yes",

          "requiredInputs": "st1|state|city|zip|country",

          "states": "textbox",

          "subfields": "state|zip|st1|city|st2",

          "sublabels": {

            "cc_firstName": "First Name",

            "cc_lastName": "Last Name",

            "cc_number": "Credit Card Number",

            "cc_ccv": "Security Code",

            "cc_exp_month": "Expiration Month",

            "cc_exp_year": "Expiration Year",

            "addr_line1": "Street Address",

            "addr_line2": "Street Address Line 2",

            "city": "City",

            "state": "State / Province",

            "postal": "Postal / Zip Code",

            "country": "Country"

          },

          "text": "Address",

          "type": "control_address"

        }


    This doesn't agree with what is shown on screen. The API data has a bunch of CC fields that don't appear on the form. If I read the "subfields", it says there should be state|zip|st1|city|st2. But what is st1 and st2? These are not fields shown on screen or in the sublabels of the API data.

    The actual data I receive from a webhook call looks like this:

    "q4_address4":{"addr_line1":"123 Main Street","addr_line2":"","city":"Georgetown","state":"Ohio","postal":"12345"}

    This data lines up some with the sublabels provided by the API call, but, of course, none of the CC fields are there.

    So how do I reconcile all this? If I look on the form I see one set of fields. If I call the API to ask what fields are there I get a different set of fields, some of which don't appear at all in the data (Like st1 or zip). If I get the actual data from a webhook I get some values that appear as sublabels in the API call, but not all the values that the API call describes.

    I simply want to be able to map your fields to values in my database, but it's unclear how I do this when the field names appear to vary so much.

  • Lorenz JotForm Support
    Replied on September 6, 2024 at 12:52 AM

    Hi Philip,

    Thanks for reaching out to Jotform Support. The cc fields pertains to the payment integration fields in the form. Do you have one added before? I checked your form 242187232651151, and it doesn't have any payment integration added to it now, so perhaps you've deleted it already. The result you shared, is that from a different form? Can you please confirm?

    Once we hear back from you, we'll be able to help you with this.

  • Philip_Thorne
    Replied on September 6, 2024 at 1:05 AM
    The customer created this form, so I cannot say. But visually it only shows the address fields, not the cc ones. I just need to know how to deal with random stuff like this from the programming side.


    ...
  • Cecilia JotForm Support
    Replied on September 6, 2024 at 3:17 AM

    Hi Philip

    When I checked your only form in your account named New Customer Registration Form, I saw that you don't have a payment integration connected to your form. So what you're getting from API return is due to not connecting a payment method to your form. If that's not the form you're mentioning, can you send us the form URL so we can help you better? Here's how you can connect a payment method:

    1. Click on the Add Form Element menu on the left side of the Form Builder page.
    2. Under the Payments tab, choose one of the PayPal options.
    3. In the panel on the right side of the page, click on Connect. This will take you to the PayPal page.
    4. Now, enter all of the necessary information and connect your PayPal account with your form. That's it. You're done.

    Please explain address field IDs logic Image 1 Screenshot 20

    If you'd like more information about the payment limits, check out Jotform's Pricing page.

    Give it a try and reach out again if you need any other help.

  • Philip_Thorne
    Replied on September 6, 2024 at 11:35 AM
    I appreciate your responses but you seem to be avoiding the question. I will not be responsible for creating the forms. The customer may do something stupid like use a credit card address collector and then not link it to a payment method. I need to be able to handle these kinds of mistakes. What I need to know is how to understand the relationship of the data I see in three areas: the visible form vs the API to ask what questions are present vs the actual data sent in the web hook. If I can understand your logic of how the questions provided by the API line up with the actual data sent via the web hook, I can create an integration to your product.

    Thank you.

    ...
  • Bilal JotForm Support
    Replied on September 6, 2024 at 12:01 PM

    Hi Philip,

    You can create a form and test out the API structure of the form, as every field consists of unique question names, this way you'll get more detailed information about receiving submission data from Jotform through API.

    Keep us updated and let us know if you have any more questions.

  • Philip_Thorne
    Replied on September 6, 2024 at 12:15 PM
    This was a lazy answer. I have already documented that my confusion is that the visual results don’t match the API results which don’t match the API question results. I have already done the step you requested so your answer is not helpful.


    ...
  • Christopher JotForm Support
    Replied on September 6, 2024 at 1:25 PM

    Hi Philip,

    st1 is equal to addr_line1 and st2 is equal to addr_line2 as shown in the screen recording.

    Please explain address field IDs logic Image 1 Screenshot 20

    Let us know if there’s anything else we can help you with.

  • Philip_Thorne
    Replied on September 6, 2024 at 1:35 PM
    Thank you for that information, but how would I know that except through asking support? How can I make a general purpose integration if some of the fields don’t have the same name in each of the uses? Is there documentation of these variations anywhere?


    ...
  • Angelica JotForm Support
    Replied on September 6, 2024 at 2:17 PM

    Hi Philip,

    You may check Jotform's API documentation here or send an email to api@jotform.com for more detailed information regarding API.

    We also have a guide about How to Create Jotform API Keys that you can check out.

    Reach out again if you need any other help.

Your Answer