Checkboxes webhook inconsistent


#1

by now a lot of users have probably built in fixes for this to their processing files, but worth bringing up in case someone else runs into the same problem.

If you have checkboxes on your form and use a webhook you’re interpreting as XML, the structure Unbounce sends is not consistent - rather than sending the same nested structure in all cases, it sends it a nested array only if there’s multiple options selected, otherwise it sends as a single string.

Examples:
(checkbox name is tv shows, two options selected):
XML Response:

Game of Thrones
Walking Dead

BUT, if only one option is selected:
XML Response:
Game of Thrones

SO… if you’re processing this data, you can’t just loop through each $data->tv_shows->entry and add to an array - b/c a single value doesn’t have . You first have to determine if you’re dealing with one value or more than one, and process them differently.

Ideally it’d be the same no matter how many checkboxes are ticked… so even if there’s only one value selected, it still uses the convention