From 5628eb7862376b3e4dfbb196148cfa1b0b99f25e Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Mon, 7 Mar 2016 17:32:05 +0000 Subject: [PATCH] forms: Fix form field uid Automated $uid is initialized as null - this resulted in the initial field getting a null id. --- include/class.forms.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/class.forms.php b/include/class.forms.php index 59bd50d38..389f74e48 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -540,15 +540,19 @@ class FormField { static $more_types = array(); static $uid = null; + function _uid() { + return ++self::$uid; + } + function __construct($options=array()) { $this->ht = array_merge($this->ht, $options); if (!isset($this->ht['id'])) - $this->ht['id'] = self::$uid++; + $this->ht['id'] = self::_uid(); } function __clone() { $this->_widget = null; - $this->ht['id'] = self::$uid++; + $this->ht['id'] = self::_uid(); } static function addFieldTypes($group, $callable) { -- GitLab