Ticket #2485 (closed defect: duplicate)

Opened 2 months ago

Last modified 2 weeks ago

Form 'checkboxes' output displaying as integers instead of labels in email.

Reported by: dancrew32 Assigned to: aoneil
Type: defect Priority: medium
Milestone: 2.2.3 Component: CMS - Field editor
Version: 2.2.2-rc2 Severity: medium effort / impact
Keywords: checkboxes, integer, error Cc:
Due date: Harvest Task: (Unknown)
Invoice sent to client: 0 Hours:

Description

So in my 'checkboxes' field, I have 4 options, and each option outputs in the email as integers like 41,37,27,36 instead of writing out the name of the checkbox label. Would appreciate an idea for a fix!! thanks

Attachments

Change History

Changed 1 month ago by Henk_Poley

Patch, only works for new submissions since old ones are just stored as text (AFAIK):

--- /Users/henk/Downloads/silverstripe-v2.2.2/sapphire/forms/EditableCheckboxGroupField.php
+++ EditableCheckboxGroupField.php
@@ -144,9 +144,9 @@
 		$selectedOptions = DataObject::get( 'EditableCheckboxOption', "ParentID={$this->ID} AND ID IN (".implode(',',$entries).")" );
 		foreach( $selectedOptions as $selected ) {
 			if( !$result )
-				$result = $selected->ID;
+				$result = $selected->Title;
 			else
-				$result .= "," . $selected->ID;
+				$result .= "," . $selected->Title;
 		}
 		return $result;
 	}

Changed 1 month ago by sminnee

Note: this might have already been fixed in an internal project-specific branch (epmu)

Changed 2 weeks ago by aoneil

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #2322/

Note: See TracTickets for help on using tickets.