From 6ce040fd2003e7164b80ad2e46d1dc48616465aa Mon Sep 17 00:00:00 2001 From: Isaiah Fischer Date: Thu, 7 Dec 2017 11:38:29 -0600 Subject: [PATCH] Allow sets of select ones to behave like text inputs Multi Selects aren't very intuitive to use for most users (in my experience), so using multiple `select-one`s in series with the same field name is common for me. Being able to have those act the same as inputs with the same name allows spreading of the values out. --- src/jquery.deserialize.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/jquery.deserialize.js b/src/jquery.deserialize.js index 13c00e2..2d85454 100644 --- a/src/jquery.deserialize.js +++ b/src/jquery.deserialize.js @@ -206,6 +206,12 @@ // Handle select menus, checkboxes and radio buttons } else if ( property == "checked" || property == "selected" ) { + + // If the selects are select-ones then only update matching index with value + if( element.options && !element.multiple && elementIndex != valueIndex ){ + return; + } + var fields = []; // Extract option fields from select menus