Skip to content

Commit

Permalink
Don't convert disabled fields in formParams. Closes #24
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Jun 14, 2012
1 parent 1c69608 commit 55ee6b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions dom/form_params/form_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ steal("jquery/dom").then(function( $ ) {
seen = {},
current;


this.find("[name]").each(function() {
this.find("[name]:not(:disabled)").each(function() {
var $this = $(this),
type = $this.attr("type"),
name = $this.attr("name"),
Expand Down
8 changes: 8 additions & 0 deletions dom/form_params/form_params_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,12 @@ test("#17 duplicate sub-keys", function() {
console.log(formParams);
});

test("#24 disabled elements", function() {
$("#qunit-test-area").html("//jquery/dom/form_params/test/basics.micro",{});
var formParams = $("#qunit-test-area form").formParams();
console.log(formParams);
ok(!formParams.is_disabled, 'Disabled field is not included');
equals(formParams.not_disabled, 'not disabled', 'Not disabled field');
});

});
3 changes: 3 additions & 0 deletions dom/form_params/test/basics.micro
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@

<input type='text' name='test[first]' value='test_first' />
<input type='text' name='bla[first]' value='bla_first' />

<input type='text' name='is_disabled' disabled='disabled' value='disabled' />
<input type='text' name='not_disabled' value='not disabled' />
</form>

0 comments on commit 55ee6b1

Please sign in to comment.