Title: Comma separate checkbox fields
Last modified: November 17, 2017

---

# Comma separate checkbox fields

 *  Resolved [tbare](https://wordpress.org/support/users/tbare/)
 * (@tbare)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/comma-separate-checkbox-fields/)
 * I’ve added a bit of code in the shortcode function (at line 495) to make a checkbox
   show as comma separated —
 *     ```
       //if the field is a checkbox field
       elseif(is_array($field_value) && $field["type"] == "checkbox" ) {
   
       	//sort the array by key
       	ksort($field_value);
       	$field_values = "";
   
       	// Concatenate field values into string separated by a comma
       	foreach ($field_value as $field => $value) {
       	   if($value !== "") { $field_values .= $value . ", "; }
       	}
       	$field_values = trim($field_values, ', '); // strip the last ', ' space from the end of the string
       	$list_html .= "<td class='sort-$i $nowrap $tdClass'>$field_values</td>";
       }
       ```
   
 * May be worth an adding in (or as an option) in a future release?

Viewing 1 replies (of 1 total)

 *  Plugin Author [fried_eggz](https://wordpress.org/support/users/fried_eggz/)
 * (@fried_eggz)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/comma-separate-checkbox-fields/#post-9718440)
 * Good idea! I have added a setting for this (will be included in version 1.5) 
   where you can choose between space or comma. The setting is located under “General
   settings” and its called “Multiple values separator”.

Viewing 1 replies (of 1 total)

The topic ‘Comma separate checkbox fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gravity-forms-sticky-list_9b65b3.
   svg)
 * [Gravity Forms Sticky List](https://wordpress.org/plugins/gravity-forms-sticky-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-sticky-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-sticky-list/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-sticky-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-sticky-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-sticky-list/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [fried_eggz](https://wordpress.org/support/users/fried_eggz/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/comma-separate-checkbox-fields/#post-9718440)
 * Status: resolved