Forum Replies Created
-
AuthorPosts
-
#2: All I can suggest is experimenting with different placement of the line break tag. In this case, trial and error is your friend.
1a. Here’s JS code to get a timestamp. Wrap it in a function and call it. Modify it as needed to get the portion of the timestamp you want.
var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) { dd='0'+dd } if(mm<10) { mm='0'+mm } today = mm+'/'+dd+'/'+yyyy;
1b. By looking at the tooltip for “Set Field Value” on the Rules configuration page in DFFS, we see we can use {timestamp[dd.MM.yyyy hh.mm.ss]} to format the DFFS timestamp function. So, you could try changing the line
var dateTime=spjs.dffs.buldValStr("{timestamp}");
to
var dateTime=spjs.dffs.buldValStr("{timestamp[dd.MM.yyyy]}");
I have never tested this.
Good luck.
Separate answer coming for #2 once I have time to parse the question.
- This reply was modified 6 years ago by Keith Hudson.
- This reply was modified 6 years ago by Keith Hudson.
Sorry for the delay in responding.
I am attaching a Word document with code and screenshots to explain my approach when using an Enhanced Rich Text field. In this approach, the author and timestamp is bolded.
Mike;
I’ve now seen used the DFFS email capability used on one project where it seemed to work well, but I’ve also heard feedback from other users that seem to have found it gave them inconsistent results.
What has your experience been?
Mike, I’m glad the nested if statements in a calculated field worked for you. You mentioned that workflows can fail to keep up (I assume you mean that they may not run in a timely manner reliably). *IF* you are the farm admin, and if the lack of reliability is due to long delays in workflows executing, you MIGHT be able to make them more reliable. There is a setting in Central Administration for how many workflows can be processed simultaneously. The default is 8. I have seen a white paper written by someone who tested increasing that setting to 25,000 with no observable performance issues in their environment. Just a thought. Most of us are NOT the farm admin, so we are stuck with whatever settings the farm admin chooses, and most farm admins wouldn’t know about that setting, or would be afraid of breaking a site by changing it.
If you have already made sure you have a function called toggleCreateButton1, try copying that function and pasting it into jshint.com to see if there is a syntax or typing error in the function that is causing it to break.
As Alex indicates, the custom javascript function you wrote in DFFS will not work in the Quick Edit view, because it relies on the underlying DFFS code that Alex wrote only for use on the new, edit and display forms.
To illustrate, I will refer to the two fields you are dealing with as the Source field and the Target field. From your original post, it sounds like your Target field is in fact a SharePoint lookup field. If that is true, then my first idea below will not work.
First idea:
Change the Target field to a calculated field (by deleting the original Target field and creating a calculated field of the same name). Use nested if statements to set the value of the Target field as you did in your custom javascript function. You can’t use a switch statement, but you can use the AND, OR and IF functions in a calculated field. (Lots of info on those functions in google).If that approach WILL work for you and you have trouble getting the formula for the calculated column set up, post here and I’ll try to offer some help.
Second idea:
If the Target field must remain a Lookup field, you could remove it from the view on which users are making their changes (or simply instruct them to ignore it) and use a SharePoint Designer workflow that fires every time an item is changed to apply the logic that will update the Target field with the value you want it to have.
My javascript skills do not come anywhere close to Alex’s, but here are two approaches to solve this issue. I would create a rule that fires a javascript function every time the value of Column A changes, and use a javascript function to to set the field value of the lookup field.
Version A: uses a javascript switch statement (You can read up on what a switch statement is here: https://www.w3schools.com/js/js_switch.asp) (Although this is not the most efficient way to meet your need, I’m including it because it is so useful for situations very similar to yours.)
Here’s the javascript function, using sample values:
function updateColumnA(){
var colA = getFieldValue(‘ColumnA’); //make sure you use the internal field name
switch(colA) {
case ‘1’:
setFieldValue(‘LookupField’,’Name 1′);
break;
case ‘2’:
setFieldValue(‘LookupField’,’Name 1′);
break;
case ‘3’:
setFieldValue(‘LookupField’,’Name 1′);
break;
case ‘4’:
setFieldValue(‘LookupField’,’Name 1′);
break;
case ‘5’:
setFieldValue(‘LookupField’,’Name 2′);etc.
default:
//code block (you may or may not need a default code block)
} //end of switch statement} // end of function
NOTE that the tick marks around the case values is required if your values are strings, and NOT required if Column A is a number column. You’ll have to create one ‘case’ statement for each value of ColumnA, which in your case (you are mapping several values of ColA to a single value in LookupField), is a bit repetitive, so you might prefer approach B, below.
Approach B:
function updateColumnA(){
var colA = getFieldValue(‘ColumnA’); //make sure you use the internal field name
if (colA === ‘1’ || colA === ‘2’ || colA === ‘3’ || colA === ‘4’){
setFieldValue(‘LookupField’,’Name 1′); //use the field internal name for LookupField
} //end of first if statement
if (colA === ‘5’ || colA === ‘6’ || colA === ‘7’ || colA === ‘8’){
setFieldValue(‘LookupField’,’Name 2′); //use the field internal name for LookupField
} //end of second if statement
etc.
} // end of functionUse as many if statements as needed. If ColA holds numbers, don’t use tick marks around the values in the if statement.
Good luck.
William, I just saw this about code to hide a tab. The id of the tab is “dffs_tab_5” where 5 is the tab index. So, you can just use $(‘#dffs_tab_5’).hide() to hide tab with index 5.
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 6 years, 2 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.
-
AuthorPosts