Dec 01, 2023 10:52 AM
Hi all,
I have a simple script that is taking some items from the submission of a Gravity Form and updating an AirTable record. It all works great until I get to a section of the form that has checkbox values. INSIDE of one of those checkbox values is a string that contains a comma
Checkbox choices
Apples
Oranges
Pears
Grapes, limes and lemons
I can gather all of these out of Gravity Forms and put them in an array and then implode that array to get a comma delimited list, which is what AT wants to absorb that data for checkboxes.
$c=Apples, Oranges, Grapes, limes and lemons
"records": [
{
"id": "'.$id.'",
"fields":
{
"Committees": "'.$c.'"
}
}],
"typecast":true
}';
This of course will cause AT to barf when that comes in and tries to split the Grapes out as its own committee and limes and lemons as another committee. I know that in order for AT to treat a Linked Table field items containing commas is to put quotes around it. When I try and quote the incoming data here the update bombs.
$c="Apples", "Oranges", "Grapes, limes and lemons"
Does anyone have any thoughts on what I can do here? Thanks!
Solved! Go to Solution.
Dec 01, 2023 11:16 AM
SOLUTION
The escaping of the double quotes in this case needed to be the triple lines and not the single. Not sure why but in case anyone else runs into the issue sending data via the CURL.
$c.="\\\"".$value."\\\","; <-- This worked
$c.="\"".$value."\","; <-- This did not work.
Dec 01, 2023 11:16 AM
SOLUTION
The escaping of the double quotes in this case needed to be the triple lines and not the single. Not sure why but in case anyone else runs into the issue sending data via the CURL.
$c.="\\\"".$value."\\\","; <-- This worked
$c.="\"".$value."\","; <-- This did not work.