Checkbox results not displaying properly if there's a single answer or no answer

By: George Plumley | Asked: 10/16/2023
ForumsCategory: General questionsCheckbox results not displaying properly if there's a single answer or no answer
George Plumley asked 7 months ago

I have a checkbox field with many options and I'm using Separate Values.

Entries where only one or no answers have been chosen (the field is not required) I'm getting the following output:

,,,Lack Staff Capacity,

In other words, it's spitting out the comma-separated values stored in the database.

I came across this comment from Victor Font in another forum post:  

If a checkbox only has one selection, it is stored in the database as plain text, not a serialized array.

I'm wondering if that's why I'm having this issue, and if so, is there a function I need to be running on all checkboxes to overcome this? I didn't see any related Developer Hooks that might already address this, if indeed that's the issue...

The entries were all imported via CSV. I had massaged a spreadsheet to gather all the values into a single column, with commas separating each value.

Maybe, in the case of single values or no value, I need to remove all the commas before doing the import?

Thanks!  

Victor Font replied 7 months ago

I wasn't going to answer this because Rob Levine gave you the right answer to troubleshoot your CSV formatting. But since you quoted me, I thought I'd chime in. Thank you, by the way.

Chances are good your CSV format is incorrect. I don't know of any good reason to ever compress multiple fields into a single spreadsheet column. That is, if I'm understanding you correctly when you say,

"I had massaged a spreadsheet to gather all the values into a single column, with commas separating each value."

Import CSV formats must have a single value or absence thereof in each column you want to import into a Formidable Form. Even empty values must be limited. CSV delimiters are two double quotes plus comma.

Fields with values are delimited as "value",
Absence of values are formatted as "",

When strung together, your .csv should look like "value-1","","","value-4","",

When I see values like yours, ",,,Lack Staff Capacity,", it makes me think this is how the string was formatted in the CSV and not something Formidable did.

What Rob asked you to do is really good learning advice. I highly recommend following his suggestion.

George Plumley replied 7 months ago

<p>My description of the spreadsheet process was poor, Victor. I was faced with client data in which each of the checkbox values were in separate columns of a spreadsheet, so I was concatenating them into a single column, before creating my csv. But having done Rob's excercise below, I'm realizing that, yes FF needs commas between multiple checkbox values, but not a comma for every possible value, which is what I was doing. I need to clean up my concatenation! Thanks to you both!</p>

1 Answers
Rob LeVineRob LeVine answered 7 months ago
The best way to figure this and similar import format questions is to create two form entries, one with multiple selections and one with a single selection, export them and inspect the CSV.  That way you'll know what Formdiable expects the CSV format to be.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right