Forum Replies Created
-
AuthorPosts
-
Set All Fields on a Tab to readonly:
Add this snippet to your Custom JS and call it from the “Click function name” in your tab:
function readOnlyAllFieldsInTab(){
var arrToSetReadonly = [];
jQuery.each(spjs.dffs.data.tabConfigObj[spjs.dffs.data.selectedTab].fields,function(i,fin){
if(spjs.dffs.fieldData[fin] !== undefined){
arrToSetReadonly.push(fin);
}
});
spjs.dffs.doReadOnly(arrToSetReadonly);
}
Please note that the fields will stay read-only when you change tabs – you would have to set the fields as editable again in the other tabs.Chandan;
As your form moves from one step to the next, you could store an array of the step names for the steps that have already happened in your multi-line text field. Then, on your form, you can use an HTML section to construct a select element, and use add() method as explained here https://www.w3schools.com/jsref/met_select_add.asp to loop through the array of previous steps and add them to the select drop down.
May 30, 2018 at 18:54 in reply to: Reversals on one field visible/required when referenced by 5 rules #21041Adrian:
If I understand correctly, you want to have Notes field become visible and be required if ANY of the 5 trigger fields is set to Yes.
If I’m correct, try this:
1. Create a separate rule for each trigger field. The rule should evaluate to TRUE if the trigger field is changed to Yes. Do not include any actions in the rule.
2. Create a sixth rule that links all the other rules and if any one of them is TRUE, sets the Notes field to visible and required.Alex;
1. It looks like spjs.dffs.flag_Mandatory(‘FieldInternalName’) will set the field to required AND show the red star on that field. Is that correct?
2. Is there an internal dffs function that does the opposite? (that is, sets the field to optional and removes the red star on that field? Or a function just to remove the red start, if we use spjs.dffs.data.requiredFields = spjs.dffs.removeFromArr(spjs.dffs.data.requiredFields,”YourFieldName”) to make the field optional again?Programmatically set required field:
Required fields are stored in this array:
spjs.dffs.data.requiredFieldsand you can push in new fields like this
// Push new required field into array
spjs.dffs.data.requiredFields.push(“YourFieldName”);
// Show star on all required fields
spjs.dffs.starRequired();If you need to remove a field from the array, you can use this function:
spjs.dffs.data.requiredFields = spjs.dffs.removeFromArr(spjs.dffs.data.requiredFields,”YourFieldName”);From: https://spjsblog.com/forums/topic/programmatically-set-required-field/
See also: https://spjsblog.com/forums/topic/programmatically-set-field-to-required-based-on-multiple-inputs/- This reply was modified 6 years, 7 months ago by Keith Hudson.
Thanks for the prompt reply, Alex. I’m trying to figure out how to ‘reconstitute’ the hidden fields the next time my form opens from the list column where I saved the array of hidden fields (my column is name ‘luHiddenFields’). So far, I’ve got this much:
var arrHiddenFields = getFieldValue(“luHiddenFields”).split(“,”);
for (var i=0; i < arrHiddenFields.length;i++){
var fieldId = “dffs_” + arrHiddenFields[i];
jQuery(fieldId).hide();
}
This successfully hides the fields. However, I think I also need to update the spjs.dffs.data.hiddenColTrackerObj object in order to be able to capture the list of hidden fields when I save the current tab (in case more fields have been hidden). How would I do that? Or, should I just append the new hidden fields to my array of hidden fields stored in my luHiddenFields column?spjs.dffs.triggerSave(); saves record
Changing tab colors
/* Style base tab */
li.tabBase a{
background-color:gray!important;
padding:0 2px!important;
}
li.tabBase span{
color:black!important;
}
/* Style selected tab */
li.tabSelected a{
background-color:green!important;
padding:2px!important;
}
li.tabSelected a span{
color:yellow!important;
}from https://spjsblog.com/forums/topic/css-style-of-selected-tab/
Using Created and Created By in DFFS
Start by adding a HTML section in the tab with the Unique ID “CreatedBy”.Then add this to the Custom JS:
(function addCreatedByToTab(){
var b = [];
b.push(“<tr>”);
b.push(“<td class=’ms-formlabel’>”);
b.push(“<span class=’ms-h3 ms-standardheader’>Created by</span>”);
b.push(“</td>”);
b.push(“<td class=’ms-formbody’>”);
b.push(spjs.dffs.beforeProperties.Author[0]);
b.push(“</td>”);
b.push(“</tr>”);
jQuery(“#dffsHTML_CreatedBy”).replaceWith(b.join(“”));
})();from: https://spjsblog.com/forums/topic/using-created-and-created-by-in-forms/
OK, I figured it out. No need for an internal save function. This does the trick:
jQuery(‘input[value=”Save”]’).trigger(“click”);After further work, it looks like I was making an error in the placement of the quotation marks in the expression.
It is working now. I don’t know what happened, unless I had some tiny error in the code and didn’t notice it, or we had some kind of server glitch.
I’m trying it from the Console on the DFFS config page and it is not working. It SHOULD work there, correct?
make all visible tabs readonly, and set current tab fields to editable:
https://spjsblog.com/forums/topic/easy-way-to-make-all-fields-readonly/
Get current user name
var userInfo = spjs.utility.userInfo(spjs.dffs.data.currUserID);
// userInfo is an object with multiple properties – use console.log(userInfo) to see all
// Here is the title
alert(userInfo.Title);from: https://spjsblog.com/forums/topic/internal-function-to-get-current-logged-in-user/
-
AuthorPosts