The below code works only for IE
<script language="javascript" type="text/javascript" src="../../SiteAssets/jquery-1.11.1.min.js"></script>
<script language="javascript" type="text/javascript" src="../../SiteAssets/jquery.SPServices-2013.01.js"></script>
<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push('Test');
function Test()
{
//alert("Try
now");
jQuery().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: jQuery().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status) {
var xml = xData.responseXML.xml; //Different in case of IE
//If the current User does belong to the group "Visitors" and "Issue Functional Area"
if (xml.search('Issue Functional Area') != -1)
{
//alert("No, User Doesn't
Exists!");
//
jQuery("select[title=Status]").parent().parent().parent().hide();
//or use:
jQuery('td.ms-formlabel:contains("Status")').parent().hide();
jQuery('nobr:contains("Status")').closest('tr').hide();
//jQuery(".ms-formtable tbody > tr
> td:contains('Status')").closest("tr").hide();
}
}
});
}</script>
Now the following code works for Google Chrome and Firefox
<script language="javascript"
type="text/javascript"
src="../../SiteAssets/jquery-1.11.1.min.js"></script>
<script language="javascript"
type="text/javascript"
src="../../SiteAssets/jquery.SPServices-2013.01.js"></script>
<script language="javascript"
type="text/javascript">
_spBodyOnLoadFunctionNames.push('Test');
function Test()
{
//alert("Try
now");
jQuery().SPServices({
operation:
"GetGroupCollectionFromUser",
userLoginName:
jQuery().SPServices.SPGetCurrentUser(),
async: false,
completefunc:
function(xData, Status) {
var xml =
xData.responseText; //Different in case of Google Chrome and Firefox
//If the current
User does belong to the group "Visitors" and "Issue
Functional Area"
if
(xml.search('Issue Functional Area') != -1)
{
//alert("No, User Doesn't Exists!");
//
jQuery("select[title=Status]").parent().parent().parent().hide();
//or use:
jQuery('td.ms-formlabel:contains("Status")').parent().hide();
jQuery('nobr:contains("Status")').closest('tr').hide();
//jQuery(".ms-formtable tbody > tr
> td:contains('Status')").closest("tr").hide();
}
}
});
}
</script>
No comments:
Post a Comment