1

I have a sharepoint that I need to disable two of the fields on the Edit form.

Here is the code I am using:

 $("input[title='Issue ID']").attr("disabled", true);
 $("input[title='Issue Title']").attr("disabled", true);

The fields do get set to disabled however when the form saves my record shows that both the ID and the Title are now blank. I do not want to remove the data I just don't want the user to edit the information.

When is hide the row instead this doesn't happen. I did that using:

 $("h3.ms-standardheader:contains('Issue ID')").closest("tr").hide();
 $("h3.ms-standardheader:contains('Issue Title')").closest("tr").hide();

It seems abnormal that this happens. Any suggestions or tips would be greatly appreciated.

Per the answer below I changed my code to:

 $("input[title='Issue ID']").attr("readonly", true);
 $("input[title='Issue Title']").attr("readonly", true);

This fixes the issue.

6

This is because disabled fields are actually not posted (they are not included in the post at all).

Instead try readonly attribute.

| improve this answer | |
0

http://sympmarc.com/2010/10/08/using-jquery-to-prefill-and-disable-required-column-in-a-sharepoint-form/comment-page-3/#comment-114450

here you go bro this solution works like a magic hope you get it solved.

| improve this answer | |
  • 1
    Please add more details. Links can get broken over time. – Amal Hashim Mar 17 '15 at 9:15
  • The PreSaveAction is an option. It really depends on what you are trying to do. – AxGryndr Mar 17 '15 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.