Ticket #4408: form-getValues-fix.diff

File form-getValues-fix.diff, 1.0 kB (added by guest, 15 months ago)

temporary simple fix, to make it at least work

  • form/Form.js

     
    160175 
    161176                        // get widget values 
    162177                        var obj = {}; 
     178                        var usedIds = {}; 
    163179                        dojo.forEach(this.getDescendants(), function(widget){ 
    164180                                var value = widget.getValue ? widget.getValue() : widget.value; 
    165181                                var name = widget.name; 
    166182                                if(!name){ return; } 
    167183 
     184                                usedIds[widget.domNode.id] = true; 
    168185                                // Store widget's value(s) as a scalar, except for checkboxes which are automatically arrays 
    169186                                if(widget.setChecked){ 
    170187                                        if(/Radio/.test(widget.declaredClass)){ 
     
    189206                                } 
    190207                        }); 
    191208 
     209                        dojo.forEach(this.containerNode.elements, function(elm) { 
     210                                if (!elm.name || usedIds[elm.id]===true) { 
     211                                        return;         // like "continue" 
     212                                } 
     213                                obj[elm.name] = elm.value; 
     214                        }); 
     215 
    192216                        /*** 
    193217                         * code for plain input boxes (see also dojo.formToObject, can we use that instead of this code? 
    194218                         * but it doesn't understand [] notation, presumably)