Coder Social home page Coder Social logo

Comments (3)

lane-formio avatar lane-formio commented on July 16, 2024

What provider are you using?

Here's what I have done to reproduce your scenario...

  1. Add Address Component with provider: OpenStreetMap Nominatum
  2. Post submission via API using postman with the following json object
{
    "data": {
        "address": "123 Address, Chicago, IL 60007"
    }
}

Result
Submission view shows up empty, but the data is still available in the submission object itself:
image

Here's what I did to get it to successfully display:

  1. Add Address Component with provider: OpenStreetMap Nominatum
  2. Create a dummy submission via UI to capture the submission object expected by the provider.
  3. Post submission via API using postman with the following json object
{
    "data": {
        "address": {
            "place_id": 25871661,
            "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
            "osm_type": "way",
            "osm_id": 210815525,
            "lat": "41.72382345",
            "lon": "-87.60908342557869",
            "class": "building",
            "type": "yes",
            "place_rank": 30,
            "importance": 0.00000999999999995449,
            "addresstype": "building",
            "name": "",
            "display_name": "9361, South Saint Lawrence Avenue, Roseland, Chicago, Hyde Park Township, Cook County, Illinois, 60619, United States",
            "address": {
            "house_number": "9361",
            "road": "South Saint Lawrence Avenue",
            "quarter": "Roseland",
            "city": "Chicago",
            "municipality": "Hyde Park Township",
            "county": "Cook County",
            "state": "Illinois",
            "ISO3166-2-lvl4": "US-IL",
            "postcode": "60619",
            "country": "United States",
            "country_code": "us"
            },
            "boundingbox": [
            "41.7237891",
            "41.7238579",
            "-87.6091811",
            "-87.6089858"
            ]
        }
    }
}

Posting that worked.

Then after some further tinkering I found this worked as well:

{
    "data": {
        "address": {
            "display_name": "9361, South Saint Lawrence Avenue, Roseland, Chicago, Hyde Park Township, Cook County, Illinois, 60619, United States"
        }
    }
}

image

Granted, I performed this using our portal and not in a react app.

from react.

alexknipfer avatar alexknipfer commented on July 16, 2024

@lane-formio Appreciate the detailed response! I wasn't aware we could pass in only the display_name, but that worked. Is there documentation somewhere that says what each of these form components (such as Adddress Component, etc) expect as the submission object, it wasn't clear the entire provider object OR only the display_name was required? Our team is new to the formio ecosystem, so apologies if I missed it.

I'm going to go ahead and close this out, thank you!

from react.

lane-formio avatar lane-formio commented on July 16, 2024

Our commercial offering does have inline documentation available via the "API Explorer" but the address component is certainly a little unique in that regard as the submission object varies between providers.

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.