$(document).ready(function()
{
SetStatusVariable();
DisableAllSPFields();
DisableOKButton();
// query for the current user.
$().SPServices({
});
Ok, my question is this viewing the code above on the second if statement I have an and condition. My issue is when I add the following code
var status =$("select[title='Form Submit Type']").val();
with in SPServices it returns a NULL via an alert I have set after the creation of the var.
alert(status);
so the && evaluation will not work.
The page is a SharePoint Edit.aspx page, thus the value I am setting is already there. I can set it outside spservices just fine
function SetStatusVariable()
{
var status =$("select[title='Form Submit Type']").val();
alert(status);
}
The problem for me is passing this value inside the second if statement to be evaluated.
{
SetStatusVariable();
DisableAllSPFields();
DisableOKButton();
// query for the current user.
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status) {
// Based on if user is in group A or B certain fields are enabled. if($(xData.responseXML).find("Group[Name='Group A']").length == 1)
{
EnableAllSPFields();
EnableOKButton();
}
// I would like to evalute an (&&) based on a var set outside of the SPServices. if ($(xData.responseXML).find("Group[Name='Group B']").length == 1) && (status == "submit")
{
EnableOKButton();
EnableSPField("Program Name");
EnableSPField("Run Date");
EnableSPField("Range Craft");
EnableSPField("Range Location");
EnableSPField("Range Systems");
}
}
}); });
Ok, my question is this viewing the code above on the second if statement I have an and condition. My issue is when I add the following code
var status =$("select[title='Form Submit Type']").val();
with in SPServices it returns a NULL via an alert I have set after the creation of the var.
alert(status);
so the && evaluation will not work.
The page is a SharePoint Edit.aspx page, thus the value I am setting is already there. I can set it outside spservices just fine
function SetStatusVariable()
{
var status =$("select[title='Form Submit Type']").val();
alert(status);
}
The problem for me is passing this value inside the second if statement to be evaluated.
if ($(xData.responseXML).find("Group[Name='Group B']").length == 1) && (status == "submit")
Bottom line I want to evaluate if a person is in a group and if the status is equal to submit.