Forum Replies Created
-
AuthorPosts
-
Weird. Alex may have some troubleshooting ideas for you when he gets time to respond to this post, but here are a few ideas to explore:
1. Is it possible that you have a rule on your DFFS form that runs when that is trying to set the value of those fields to a non-permitted value? Or a rule that changes the values for some reason?
2. Turn on the developer tools in the browser (F12) before loading the DFFS form and choose the Console tab in the developer tools, then load the new form (or refresh the page if the new form is already open) and see if there is any error message in the console when the form loads. If so, post the error message here.
3. Turn on debugging on all the rules on your new form and see if that gives you any clues as to what is happening. (I confess I haven’t used the rule-debug feature of DFFS much, so I’m not the best one to guide you in how to read the debug messages, but I have friends who make heavy use of it).I have never had a problem getting a field that is not shown on my DFFS form to default to the value set on the SharePoint list settings for that field.
You might try turning DFFS off on the new form temporarily, and see whether the field gets correctly set to the value you have specified as the default value in the list settings in the native SharePoint form when you create a new item. Perhaps there is something else preventing it.
1. Here’s some code I have used in the past to change the text on the Save button:
function changeSaveButton(currLabel,newLabel){
var inputcontrols = $(‘input’);
alert(inputcontrols.length);
for(i = 0; i<inputcontrols.length; i++)
{
if(inputcontrols[i].type == “button” && inputcontrols[i].value == currLabel)
inputcontrols[i].value = newLabel;
}
}2. Redirecting the user to a specific page after clicking Save can be done with basic SharePoint functionality. Simply include the url of the page you want the user directed to after they save OR cancel the New form by including it as the Source querystring parameter on the link they click to open the new form on your list.
For instance, if your list is named MyList, and you want the user to go to a page called ThankYou.aspx located in your Pages library after they save or cancel, give them this link to click to start a new item: http://myserver/sites/MySite/Lists/MyList/NewForm.aspx?Source=/sites/MySite/Pages/ThankYou.aspx.
September 22, 2018 at 17:47 in reply to: DFFS Built-in Function Reference – seeking volunteers #22175Add Prev/Next buttons at top of form
var b = []; b.push("<div style='padding:2px;text-align:right;border-bottom: 1px #808080 solid;'>"); b.push("<input class='ms-ButtonHeightWidth' type='button' value='Previous tab' onclick='spjs.dffs.navTab(0);'>"); b.push("<input class='ms-ButtonHeightWidth' type='button' value='Next tab' onclick='spjs.dffs.navTab(1);'>"); b.push("</div>"); jQuery(".dffsTabRow").after(b.join(""));from: https://spjsblog.com/forums/topic/general-dffs-enhancement-suggestions/#post-19314
-
This reply was modified 7 years, 4 months ago by
Alexander Bautz. Reason: fixed code snippet
Easy way to “pause” a splash (overlay) screen.
We have encountered a situation where we would like to be able to include simple instructions to our users on the overlay as the form is opening, and control how long the overlay shows. Could you add a setting for that?Easy way to copy a single rule (or selected rules) or a single tab (or selected tabs) from one config to another.
Alex, I’ve had some developers who have been working on some very complex forms ask me if there is a way to copy a single rule or a set of rules from one config to another (for instance, to copy a rule developed in the New form config and copy it into the Edit form config).
I have sometimes also wished there was an easy way to copy just one tab from the New config to the Edit config.
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 7 years, 9 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/
-
This reply was modified 7 years, 4 months ago by
-
AuthorPosts