Ticket #3501 (closed bug: invalid)
Possible Bug with Disabling Inputs?
| Reported by: | jkozuch | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | 1.3 |
| Component: | selector | Version: | 1.2.6 |
| Keywords: | Cc: | jkozuch, flesler | |
| Blocking: | Blocked by: |
Description
Hi,
I think I may have found a bug where it concerns disabling input fields in a form. I have repurposed this code snippet to enable/disable inputs if a checkbox is checked/unchecked:
(document).ready(function() {
var reqsagree = $("#reqsagree"); var inital = reqsagree.is(":checked"); var reqs = $("#supplierform")[inital ? "removeClass" : "addClass"]("gray"); var reqsInputs = reqs.find("input").attr("disabled", !inital);
$("#supplierform").hide(); reqsagree.click(function() {
$("#supplierform").show(); reqs[this.checked ? "removeClass" : "addClass"]("gray"); reqsInputs.attr("disabled", !this.checked);
});
});
What is happening is that even if the checkbox with an id of reqsagree doesn't disable textareas, selects, etc. The only form elements that are disabled are input fields (text, file, submit, etc). I have to disable textarea's, selects, etc using:
var reqsTextarea = reqs.find("textarea").attr("disabled", !inital); var reqsSelect = reqs.find("select").attr("disabled", !inital);
and enable them on checkbox click using:
reqsTextarea.attr("disabled", !this.checked); reqsSelect.attr("disabled", !this.checked);
This solution works fine, but I am not sure if this is a bug, or if I have written my code incorrectly (which is a possibility, given that I am still getting used to jQuery.)
Would you be so kind to confirm if this in indeed a bug or just lack of understanding on my part?
Thanks,
Justin
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Can you turn this loose data into a formal test case ? a minimalistic html file with the requires html and js to reproduce the problem. Thanks.