Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How i can make a MakeReadOnly() field Editable again ? #53

Open
johnHappy123 opened this issue Feb 6, 2018 · 3 comments
Open

How i can make a MakeReadOnly() field Editable again ? #53

johnHappy123 opened this issue Feb 6, 2018 · 3 comments

Comments

@johnHappy123
Copy link

johnHappy123 commented Feb 6, 2018

I am facing this problem when using SPUtility.js inside my SP 2013 on-premises, now i want to do the following inside my sharepoint 2013 list forms:-

  1. Set a Choice field as ReadOnly.
  2. then chnage the value of the ReadOnly Choice field using SPUtility or pure JavaScript.

now to make my Choice field ReadOnly i use the following SPUtility method:-

SPUtility.GetSPFieldByInternalName('OrderStatus').MakeReadOnly();

but when i tired to change the value of the list after making it ReadOnly, as follow:-

SPUtility.GetSPFieldByInternalName('OrderStatus').SetValue("In Progress");

OR using pure javascript appraoch as follow:-

$('[id^="OrderStatus"]').val("In Progress");

i was unable to change the status value? so can anyone adivce how i can handle this problem? so i can change the value of a ReadOnly list?
second point, is there a way i can temporary remove the MakeReadOnly() effect on the field? if this is possible , then i can remove the ReadOnly effect on the Choice field, then set its value, then make it as ReadOnly again ?
Thanks

@kitmenke
Copy link
Owner

kitmenke commented Feb 6, 2018

Hey John,
It should be able to set the value of the field even if it is read only so that is strange.

Have you tried SPUtility.GetSPFieldByInternalName('OrderStatus').MakeEditable(); ?
Thanks,
Kit

@johnHappy123
Copy link
Author

It should be able to set the value of the field even if it is read only so that is strange.

so what could be causing this issue in my case?

@kitmenke
Copy link
Owner

kitmenke commented Feb 6, 2018

Could be a variety of things. The most common issue is the HTML that SPUtility.js is expecting has changed for some reason (custom modification, sharepoint upgrade, etc.).

Unfortunately, I'm not maintaining this project anymore but if you dig into the code you might be able to figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants