From 8b9a4d4b0330c927bee20ecc65a864888cda25bf Mon Sep 17 00:00:00 2001
From: Stanislas Rolland <typo3@sjbr.ca>
Date: Wed, 30 Sep 2015 17:47:07 -0400
Subject: [PATCH] [BUGFIX] Suggest wizard for select element does not work when
 maxitems = 1

Problem: When selecting an item in the suggest wizard, a js error is
raised and the select element is not updated.
Solution: The value provided by FormEngineSuggest may be an integer.
Make it a string before applying a match function.

Resolves: #70238
Releases: master
Change-Id: I9e1944d1def442a36e17980df8696c7f6078747e
Reviewed-on: http://review.typo3.org/43672
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
index 965921f7430c..a29d8506fc37 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
@@ -160,9 +160,10 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
 		} else {
 
 			// The incoming value consists of the table name, an underscore and the uid
+			// or just the uid
 			// For a single selection field we need only the uid, so we extract it
 			var pattern = /_(\\d+)$/
-					,result = value.match(pattern);
+					,result = value.toString().match(pattern);
 
 			if (result != null) {
 				value = result[1];
-- 
GitLab