Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

person or group column as disabled using javascript/jquery

$
0
0

I would like to make Person or Group column as disabled without using designer or xslt.

I have a list which has two Person or Group column which is a lookup to a Sharepoint Group. One of the Person or Group column is single value and the other multi value. In the edit form, I want to disable both the Person or Group columns if they contain data. I don't want to use Sharepoint designer or xslt for this. 

Currently what I have is...

if($("div[id^='Person1'] span.ms-entity-resolved").length>0)
    {
      $("input[id^='Person1']").attr("disabled",true);
      $("a[id^='Person1']").remove();
    }


and in PreSaveAction() of editform , I have

f(window.location.href.toLowerCase().indexOf('editform') !== -1)
 {

  if($("div[id^='Person1'] span.ms-entity-resolved").length>0)
 $("input[id^='Person1']").removeAttr("disabled");
}
With this, when I open the ditform for the first time and if it contains data, both the columns are disabled. But when I just refresh the page in IE an X mark to remove the person appears although I removed that mark by 
$("a[id^='Person1']").remove()
In firefox, irrespective of whether I open the form first time or not, both the columns are editable.

Kindly help



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>