This is my first post here, so please let me know if I should be posting this elsewhere.
I am using SPServices on a new item form on my site in order to do a few things. I am using SPCascadeDropdowns twice to populate 2 child ddls from a single parent ddl, and I am using SPDisplayRelatedInfo to show some related fields from another list on the
form when the user selects an item from a drop down.
The SPDisplayRelatedInfo piece of this code runs every time I load the page. The new div with the related fields shows up, and when I select an item, the related info fields load with the information from the related list.
However, the CompleteFunc for the SPDisplayRelatedInfo does not always seem to run. Same with the SPCascadeDropDowns functions. Sometimes, all of the code runs perfectly. Other times, only the SPDisplayRelatedInfo piece works (minus CompleteFunc).
All of the alerts fire every time. I am not receiving any SPServices Debug messages. I am using jQuery version 1.11.2 and SPServices 2014.2.
Any assistance you could provide would be greatly appreciated.
//Function created to pull some info from the div created by SPDisplayRelatedInfo.
//This line multiplies the AssetFuelCapacity by the Daily Transaction Limit to populate the Daily Gallon Limit
$("input[title='Daily Gallon Limit']").val($("#SPDisplayRelatedInfo_AssetID td:nth-child(2)").text() * $("input[title='Daily Transaction Limit']").val());
//This line multiplies the AssetFuelCapacity by the Daily Transaction Limit * 5 to populate the Weekly Gallon Limit
$("input[title='Weekly Gallon Limit']").val($("#SPDisplayRelatedInfo_AssetID td:nth-child(2)").text() * 5 * $("input[title='Daily Transaction Limit']").val());
//Utilizes SPCascadeDropdowns. Parent list is 'Locations'
//Also utilizing SPCascadeDropdowns. Parent list is 'Managers'
//Utilize SPServices.SPDisplayRelatedInfo to pull in some fields from the Assets list
//This function is the only one in this code file that works reliably
matchOnId: false, // Added in v0.7.1
completefunc: setDailyGallonLimit, //definition above
The issue ended up having to do with the "Required Field" being appended to some of the field names when the page was rendered. If you are having the same issue, I'd view your page source to see if your fields have the text "Required Field"
being appended to them.