Home › Forums › Classic DFFS › Appended Multi-Line Text Field Questions
Tagged: AppendField
- This topic has 9 replies, 4 voices, and was last updated 5 years, 1 month ago by Brett.
-
AuthorPosts
-
-
March 29, 2018 at 17:01 #20423
I have a multi-line plain text field that appends {FIELD1}, and I need the last entry as plain text in a html formatted letter. When I use {FIELD1} in the html it gives me all of the appended history, but I need just the last entry. So I used the code below from another thread to trigger a rule that sets another non-appending text field {FIELD2} and it works… until I touch the record again then the blank/empty append on {FIELD1} results in the rule emptying {FIELD2}.
Is there an easier way to do what I want to do or is there something that I am missing?
// Plain text fields $("#dffs_FIELD1 textarea").on("change",function(){ spjs.dffs.triggerRule(["MultiLineTrigger"]); }); // Enhanced Rich text fields var initialRteVal = getFieldValue("FIELD1").replace(/<[^>]*>/g,""); $("#dffs_FIELD1 div.ms-rtestate-write").on("blur",function(){ var currVal = getFieldValue("FIELD1").replace(/<[^>]*>/g,""); if(currVal !== initialRteVal){ spjs.dffs.triggerRule(["MultiLineTrigger"]); } });
By the way – I just got access to DFFS last week and it is AWESOME!!! Thanks for a great tool!!!!
-
March 29, 2018 at 17:14 #20425
Never mind – it is working now… I think LOL
If there is a better way I still would appreciate it.
-
April 1, 2018 at 20:59 #20433
NOTE that the “Append to existing text” choice is horribly misnamed. It would be better named “show prior versions”. I never use it. Ever. Instead, I use a multi-lines of text plain text field.
The easiest way to use it is to manually add text to the plain text field. Usually, however, I want to include a date and author stamp for each added piece of text, so just above that field on my form I insert a button using an html section, that runs a custom javascript function to create a timestamp and author stamp and pre-pend those to the existing text in the field, and position the cursor so I can just type my additional text after clicking the button.
IF you need more details, post here and I’ll try to get time to capture some code and screenshots and add them to this discussion.
-
November 9, 2018 at 01:07 #22776
Keith,
I am interested in the JS code you mentioned above as I have several multi-line text fields in which multiple users enter text. Their self-submitted initials and date annotations are all over the board. Your JS would be helpful.Thanks
Mike -
November 13, 2018 at 17:23 #22832
I would be interested in Keith’s approach as well.
-
November 24, 2018 at 16:14 #22897
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.
-
November 26, 2018 at 19:13 #22905
Thanks Keith! Nice write-up. After a bit of experimentation I have two questions:
- I only need the Date, not the Time or the Day. Your JS produces: 11/26/2018, 12:08:39 PM. What is the JS to parse the timestamp and just print the Date, i.e., 11/26/2018?
- For some reason the only way I can get a line break is by placing the <br> as follows:
setFieldValue('Notes','<br><b>'+ dateTime +' '+ user +': </b>'+oldComment);
This inserts a blank line at the top of the aggregated comments. Any suggestions?
Thanks!
Mike- This reply was modified 6 years, 1 month ago by MikeS.
-
November 29, 2018 at 12:37 #22939
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, 1 month ago by Keith Hudson.
- This reply was modified 6 years, 1 month ago by Keith Hudson.
-
November 29, 2018 at 12:41 #22943
#2: All I can suggest is experimenting with different placement of the line break tag. In this case, trial and error is your friend.
-
November 29, 2019 at 10:06 #27782
This worked for me, exactly what I was after.
Just tried Keiths script from the Word doc and used it in a rule to trigger the customjs.
Expanded the date/time and rearranged the variables.setFieldValue('ActionPerformed','Updated Contract by: ' + user + ' on: ' + dateTime + '<br>' + oldComment );
Thanks heaps for sharing.
-
-
AuthorPosts
- You must be logged in to reply to this topic.