Reputation: 45
I am disabling some elements and enabling those elements while submitting form. So that i can submit those values. but i can't find values in action class but elements are getting enabled.
As i am using jquery 1.4.4 version i can't use .prop() method.
here is the code to disable the element:
$("#"+index+'_procStepTitleAutoSuggest').attr("disabled","disabled");
$("#"+index+"_crtRowActiontxt").attr("disabled","disabled");
$("select#"+index+"_stepFunction").attr("disabled","disabled");
$("input#"+index+"_stepRTime").attr("disabled","disabled");
$("#"+index+"_donotchkBox").attr("disabled","disabled");
$("select#"+index+"_applicableAccessTime").attr("disabled","disabled");
Here is the code(enabling elements) while submitting form:
$('form').submit(function(){
$("#procedure_main_div_container").find("input,select,checkbox").attr('disabled', false);
})
Please help me. Thanks in advance.
Upvotes: 0
Views: 94
Reputation: 723
You can not post disabled element value in form. just You can change your disabled to readonly attr
Upvotes: 4
Reputation: 6006
you can use this to remove the disabled attribute for all your selectors
$('form').submit(function(){
$("#procedure_main_div_container").find("input,select,checkbox").removeAttr('disabled');
})
Upvotes: 1
Reputation: 8416
Instead of this:
$('form').submit(function(){
$("#procedure_main_div_container").find("input,select,checkbox").attr('disabled', false);
})
Try this:
$('form').submit(function(){
$("#procedure_main_div_container").find("input,select,checkbox").each(function() {
this.disabled = false;
});
});
Edit:
I see the problem. attr('disabled', false)
is not doing what you expect. Mine or the other answer should work.
Upvotes: 1