I am trying to enable/disable some hidden fields based on some calculation and using jquery
prop
function, here is the code
function enableSelectedFieldsData(count, mapKey, index) {
$(#code_ + mapKey + _ + index).prop(disabled, false);
$(#description_ + mapKey + _ + index).prop(disabled, false);
$(#crossRefrence_ + mapKey + _ + index).prop(disabled, false);
$(#image_ + mapKey + _ + index).prop(disabled, false);
$(#price_ + mapKey + _ + index).prop(disabled, false);
// disable all other fields
for (var i = 0; i < count; i++) {
if (i != index) {
$(#code_ + mapKey + _ + i).prop(disabled, true);
$(#description_ + mapKey + _ + i).prop(disabled, true);
$(#crossRefrence_ + mapKey + _ + i).prop(disabled, true);
$(#image_ + mapKey + _ + i).prop(disabled, true);
$(#price_ + mapKey + _ + i).prop(disabled, true);
}
}
}
Initially i am setting disable=true for all fields and based on the selection i m trying to enable selected fields while disabling other fields, since as per my knowledge disable fields never got submitted to the server on submitting the form, but in my case they are getting submitted.
on checking using firebug i saw that the disable field value for non selected item is getting set as like
disable=
i am not sure where i am setting things wrong, any help or pointer in this regard will really be helpful.
Edit
I have taken out the relevant section from my generated HTML and placed it at jsfiddle
please have a look