RCFilters: Send form info even for empty checkboxes
authorMoriel Schottlender <moriel@gmail.com>
Tue, 13 Jun 2017 23:04:57 +0000 (16:04 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Tue, 13 Jun 2017 23:04:57 +0000 (16:04 -0700)
Make sure the url params override previous ones in case they are
empty, make sure we still send them through the fieldset form with
an empty value, rather than not send them at all (and then they are
being re-merged into the existing URL and become essentially 'sticky')

Change-Id: I294dba17c5a5b792f5bf5064a76dedefa4d12557

resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js

index d17ffff..7605fae 100644 (file)
 
                // Collect all data from form
                $( e.target ).find( 'input:not([type="hidden"],[type="submit"]), select' ).each( function () {
+                       var value = '';
+
                        if ( !$( this ).is( ':checkbox' ) || $( this ).is( ':checked' ) ) {
-                               data[ $( this ).prop( 'name' ) ] = $( this ).val();
+                               value = $( this ).val();
                        }
+
+                       data[ $( this ).prop( 'name' ) ] = value;
                } );
 
                this.controller.updateChangesList( data );