Change value of disabled checkbox

Froggy

New Member
So I've run across a little snag. I have a page where I have a checkbox being displayed but is disabled (the user can't change it's value due that it's DB driven). Below this checkbox, I have an autocomplete field. Should an item from the autocomplete come back, I need to be able to toggle the value of the disabled checkbox. However, I'm unable to do so at this moment.Here is my code so far.View\[code\]...<tr> <td class="adminTitle"> @Html.NopLabelFor(model => model.IsSpecialOrder): </td> <td class="adminData"> @Html.DisplayFor(model => model.IsSpecialOrder) @Html.HiddenFor(model => model.IsSpecialOrder) </td> </tr> <tr> <td class="adminTitle"> @Html.NopLabelFor(model => model.ItemNumber): </td> <td class="adminData"> @if (Model.Id > 0) { @Html.DisplayFor(model => model.ItemNumber) } else { @Html.EditorFor(model => model.ItemNumber) } </td> </tr>...<script type="text/javascript">...$("#ItemNumber").autocomplete({ minLength: 2, source: function (request, response) { var itemNumber = $("#ItemNumber").val(); //Get available Products based on search parameter and map data $.getJSON('@Url.Action("GetProductsByItemNumber", "PurchaseOrder")', { searchProduct: itemNumber }, function (data) { for (var i = 0; i < data.length; i++) { productData.push({ 'Id': data.Id, 'Name': data.Name, 'ItemNumber': data.ItemNumber, 'Description': data.Description, 'IsSpecialOrder': data.IsSpecialOrder }); } response($.map(data, function (item) { return { value: item.ItemNumber, id: item.Id }; })); }) }, select: function (event, ui) { if (ui.item.id == 0) { //Do some house cleaning and alert user to mistake alert("You must retry your search for a Product"); $("#Name").val(""); $("#ItemNumber").val(""); $(".ProductDescription").html(""); document.getElementById("@Html.FieldIdFor(model => model.IsSpecialOrder)").checked = false; //$("#IsSpecialOrder").prop("checked", false); return false; } //Record ProductId $("#ProductId").val(ui.item.id); //Fill RequestorExt with correct data var description = GetData(productData, ui.item.id, "desc"); var name = GetData(productData, ui.item.id, "name"); var isSpecialOrder = GetData(productData, ui.item.id, "is"); $(".ProductDescription").html(description); $("#Name").val(name); document.getElementById("@Html.FieldIdFor(model => model.IsSpecialOrder)").checked = isSpecialOrder; //$("#IsSpecialOrder").prop("checked", isSpecialOrder); } });...</script>\[/code\]From what I've been reading, disabled fields cannot be changed without enabling. I'm guessing that is the only way to fix this but wanted to make sure first. Any ideas?
 
Top