method formField: make enum field type safe.

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
manu
Posts: 1090
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

method formField: make enum field type safe.

Post by manu » Tue Sep 29, 2015 7:18 pm

In my enum field "enum:4,4.0,4.1" I have to distinct between 4 and 4.0. In the actual version there is no type comparison (===), therefore 4 and 4.0 are equal.

Code: Select all

Index: ArrayFileEdit.php
===================================================================
--- ArrayFileEdit.php	(Revision 1676)
+++ ArrayFileEdit.php	(Arbeitskopie)
@@ -210,7 +210,7 @@
         case 'enum':
             $o = '<select name="' . $iname . '">';
             foreach ($opt['vals'] as $val) {
-                $sel = ($val == $opt['val']) ? ' selected="selected"' : '';
+                $sel = ($val === $opt['val']) ? ' selected="selected"' : '';
                 $label = ($val == '')
                     ? ' label="' . $tx['label']['empty'] . '"'
                     : '';
I don't see any backdraws. Do you?

Post Reply