question

PhillipsKeith-1816 avatar image
0 Votes"
PhillipsKeith-1816 asked PhillipsKeith-1816 answered

SharePoint 2013 edit form - read-only choice field reverting to first item on save

I have a custom edit form for a SharePoint 2013 list; it contains JS code that sets all but two of the fields to readonly. When the form is opened and saved, the existing values for all of the choice fields change to the first item in each choice list, which was not intended.

Here's my JS code if you're interested:

 $(document).ready(function() {
     jQuery("input[title^='Server Name']").prop("readonly", true);
        
     jQuery("select[title^='Server Type']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='Site']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='Operating System']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='Replace Existing Server']").attr("disabled","true").css('color','#000000');
        
     jQuery("input[title^='Current Server Name']").prop("readonly", true);
        
     jQuery("select[title^='File Server']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='Print Server']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='VPN Required']").attr("disabled","true").css('color','#000000');
     jQuery("select[title^='Pre-Build Status']").attr("disabled","true").css('color','#000000');
 });


My google-fu is failing me today - I just can't find a solution. Help!

sharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PhillipsKeith-1816 avatar image
0 Votes"
PhillipsKeith-1816 answered

Closing out this question for now; there is no ready answer and the issue is not a show-stopper at this point.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered PhillipsKeith-1816 commented

Hi @PhillipsKeith-1816 ,
Per my test, I found that the script runs well.
I edit the item which title is 1234
118576-image.png
I get following form,and the choice column is not the first item in its list
118537-image.png
After saving the data doesn't change too.
We might need more details to test the exception.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (28.2 KiB)
image.png (33.0 KiB)
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What other sort of detail can I provide?

0 Votes 0 ·

Hi @PhillipsKeith-1816 ,
Do you have any other script which can make an impact on the page?

0 Votes 0 ·

No; there is also a customized new item form, but it has shown no impact on the edit form. If I disable the JS code in the edit form, so that all fields are editable, then the item will be saved as-is, with no sudden changes made to those drop-downs.

0 Votes 0 ·
Show more comments