As shown on the screenshot I have a form with several Inputs (checkboxes, dropdowns, radios, text area (1)). Now by clicking on the button “Generieren” (2) I’d like to pass a string consisting of the individual values of the inputs to an API.
I failed several times collecting all the values and combining them to one string (value 1 + value 2 + value 3 -…). Can anyone here help me with this?
Webflow basically uses default form behavior, so the browser is simply submitting the data from the fields. I don’t think it generates e.g. CSV strings if that’s what you’re looking for.
You can prepare the data however you like in a custom code onsubmit handler though.
Hey Marc,
So If I understand correctly you want to grab and collect the values from the inputs & combine them into one string & post it to an API.
Depending on if I have understood you correctly, there are two ways I would suggest achieving this. Both ways are using Webflow logic, you can make HTTP requests natively in Webflow.
1st: Sending via JSON data to the API:
-X POST https://yourapi.com/
-H Content-Type: application/json
-H Authorization: (If you need it)
-D {"{fieldOne}{fieldTwo}{fieldThree}"}
2nd: Sending via parameters in the URL to the API.
-X POST https://yourapi.com/{fieldOne}{fieldTwo}{fieldThree}
-H Authorization: (If you need it)
-X POST https://yourapi.com/?data={fieldOne}{fieldTwo}{fieldThree}
-H Authorization: (If you need it)