Friday, 6 September 2013

Disabled & Ready Only Fields - Remove Before Submit - Jquery

Disabled & Ready Only Fields - Remove Before Submit - Jquery

I have a form that I have a stack of fields that have been set with read
only and disabled using jquery such as follows:
$('.adminOnlyField').prop('disabled', 'disabled');
$('.adminOnlyField').attr("readonly","true");
I'm using both so the select fields also look read only to the viewer.
I want to remove these attributes from the form before it is submitted so
the other non-disabled fields will go though to my model. I've tried this
but it doesn't seem to work:
$('.clear_ready_only').click(function(e)
{
e.preventDefault();
$('.adminOnlyField').removeAttr('disabled');
$('.adminOnlyField').removeAttr('readonly');
$('#CardModifysaleForm').submit();
});
Am I missing something? I thought this would have done the job?
Thanks

No comments:

Post a Comment