0

I have added content editor webpart in NewForm.aspx in SP2013 and reading the code to javascript file called HideFields.js. The script is working as expected in IE 11 but not in Firefox, Chrome and Edge.

I got this error message in Firefox: enter image description here

So the script as below:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" language="javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
    <script type="text/javascript">

    $(document).ready(function() {

     $().SPServices({
      operation: "GetGroupCollectionFromUser",
      userLoginName: $().SPServices.SPGetCurrentUser(),
      async: false,
      completefunc: function(xData, Status) {
      var xml = xData.responseXML.xml;

       //If the current User does belong to the group "Test Group"
        if (xml.search('Test Group') == -1)
         {
             $('td.ms-formlabel:contains("Description")').parent().hide();

           }  
        }

     });

    });
    </script>
  • .ps1 extension is for powershell files and javascript files. – Ganesh Sanap Mar 21 at 6:44
  • sorry was typo. i have fixed it. Thanks – Supermode Mar 21 at 22:28

Your Answer

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

Browse other questions tagged or ask your own question.