Help

Import checkbox values from GravityForms to AT Linked Table Field (containing commas)

Solved
Jump to Solution
1744 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Jon_Eynon
6 - Interface Innovator
6 - Interface Innovator

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!

 

 

1 Solution

Accepted Solutions
Jon_Eynon
6 - Interface Innovator
6 - Interface Innovator

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.

See Solution in Thread

1 Reply 1
Jon_Eynon
6 - Interface Innovator
6 - Interface Innovator

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.