Forum Replies Created
-
AuthorPosts
-
Hi Alexander,
They are dropdown. I am also getting another error on another piece of code. It seems like i don’t have the spjs.dffs? I am confused because some JS works and others don’t,
I am using this version DFFS_v4.4.5.55_2025-04-07.
This is the code. I am trying to just hide a tab based on a list that has a Person field and a Role field. I want to hide the tab based on the persons role. I attached the error as well. I feel like my problem is I am missing a file or something? Is there anyway I can get around this?
function checkUserRoleAndToggleTab() {
var currentUser = _spPageContextInfo.userLoginName;// Query the Roles list for current user
spjs.dffs.getListItems({
listName: “Roles”,
query: “<Where><Eq><FieldRef Name=’Person’ LookupId=’TRUE’ /><Value Type=’Integer’>” + _spPageContextInfo.userId + “</Value></Eq></Where>”,
viewFields: [“Role”],
onComplete: function (data) {
var hideTab = false;if (data.count > 0) {
var role = data.items[0].Role;// Check if role is “Owner”
if (role && role.trim().toLowerCase() === “owner”) {
hideTab = true;
}
}if (hideTab) {
spjs.dffs.hideTab(“test”);
} else {
spjs.dffs.showTab(“test”);
}
}
});
}// Run the function
checkUserRoleAndToggleTab();Hi Alexander,
They are dropdown. I am also getting another error on another piece of code. It seems like i don’t have the spjs.dffs? I am confused because some JS works and others don’t,
I am using this version DFFS_v4.4.5.55_2025-04-07.
This is the code. I am trying to just hide a tab based on a list that has a Person field and a Role field. I want to hide the tab based on the persons role. I attached the error as well. I feel like my problem is I am missing a file or something? Is there anyway I can get around this?
function checkUserRoleAndToggleTab() {
var currentUser = _spPageContextInfo.userLoginName;// Query the Roles list for current user
spjs.dffs.getListItems({
listName: “Roles”,
query: “<Where><Eq><FieldRef Name=’Person’ LookupId=’TRUE’ /><Value Type=’Integer’>” + _spPageContextInfo.userId + “</Value></Eq></Where>”,
viewFields: [“Role”],
onComplete: function (data) {
var hideTab = false;if (data.count > 0) {
var role = data.items[0].Role;// Check if role is “Owner”
if (role && role.trim().toLowerCase() === “owner”) {
hideTab = true;
}
}if (hideTab) {
spjs.dffs.hideTab(“test”);
} else {
spjs.dffs.showTab(“test”);
}
}
});
}// Run the function
checkUserRoleAndToggleTab();Attachments:
Thank you Alexander, how would I modify this to work with Choice Yes or no fields?
The fields are choice fields.
What I am trying to do is if all 3 fields are yes, then a 4th field is disabled but if ANY of those 3 fields is no then that field is NOT disabled
Do I add this piece of code that you gave at the end of the other code?
Chat GPT gave me the code.
I have added the function to the Custom JS tab in DFFS and then I call it with a rule. Am I missing where else to add it?
Thank you, I have to admit I am not very up on this. How do I get that funtion to include and where do I add it?
Here is a screenshot of the error
Attachments:
Hello Alexander
I am hoping you can help me here. I am trying to launch a Custom JS script but it is not working. When I view the console here is the message I see
VM153:9 Uncaught ReferenceError: setFieldDisabled is not defined
at toggleFieldToDisable (<anonymous>:9:9)
at <anonymous>:14:1
at b (jQuery.js?v=1744295668044:2:866)
at He (jQuery.js?v=1744295668044:2:48648)
at E.fn.init.append (jQuery.js?v=1744295668044:2:49999)
at Object.loadCustomJS (eval at <anonymous> (DFFS_frontend_min.js:10:1), <anonymous>:1:202332)
at Object.loadDependencies (eval at <anonymous> (DFFS_frontend_min.js:10:1), <anonymous>:1:204183)
at HTMLDocument.eval (eval at <anonymous> (DFFS_frontend_min.js:10:1), <anonymous>:1:176726)
at e (jQuery.js?v=1744295668044:2:30310)
at t (jQuery.js?v=1744295668044:2:30612)and here is the JS I am trying to use
function toggleFieldToDisable() {
var f1 = getFieldValue(“Control_x0020_Certified_x003f_”);
var f2 = getFieldValue(“Checklist_x0020_Certified_x003f_”);
var f3 = getFieldValue(“Checker_x0020_Inventory_x0020_Ce”);if (f1 === “Yes” && f2 === “Yes” && f3 === “Yes”) {
setFieldDisabled(“Requesting_x0020_an_x0020_Except”, true);
} else {
setFieldDisabled(“Requesting_x0020_an_x0020_Except”, false);
}
}// Call it immediately on form load
toggleFieldToDisable();// Set up watchers so it also runs when these fields change
spjs.dffs.doReadOnlyOnChange.push({fin:”Control_x0020_Certified_x003f_”, functionName:toggleFieldToDisable});
spjs.dffs.doReadOnlyOnChange.push({fin:”Checklist_x0020_Certified_x003f_”, functionName:toggleFieldToDisable});
spjs.dffs.doReadOnlyOnChange.push({fin:”Checker_x0020_Inventory_x0020_Ce”, functionName:toggleFieldToDisable});setFieldDisabled(“Requesting_x0020_an_x0020_Except”, true);
I am not able to understand where I need to change the file location for JS and wondering if you can help me?
Hi Alexander,
Would you be able to tell me how I make an HTML header section collapsible and expandable? Also is there a way to pop up a preview of email before it is sent in a window?
August 16, 2023 at 23:09 in reply to: Suggestion for revision to naming convention for the ModernDFFS User Manual #37042Perfect again, this works great, thank you!
August 16, 2023 at 20:32 in reply to: Suggestion for revision to naming convention for the ModernDFFS User Manual #37039Thank you Alexander, this works perfectly. I am not sure this is the right forum, but in a multiline field, how would I add a table into it so that it comes up as a template table in that field with each new item? Would that go in the Custom CSS or within the field itself?
August 16, 2023 at 14:11 in reply to: Suggestion for revision to naming convention for the ModernDFFS User Manual #37036Hello, I am looking for the ModernDFFS user manual to see how to change the color text for field labels. Can you point me to where it is?
-
AuthorPosts