Home › Forums › Classic DFFS › Use multiline text as trigger in DFFS
- This topic has 4 replies, 3 voices, and was last updated 7 years, 6 months ago by Alexander Bautz.
-
AuthorPosts
-
-
June 27, 2016 at 20:55 #12137
Currently you cannot use a multiline text field as a trigger directly, but there is a workaround.
Add a rule with the trigger “No trigger (must be triggered manually)”, and add this code to the Custom JS textarea:
// Plain text fields $("#dffs_NameOfYourMultilineField textarea").on("change",function(){ spjs.dffs.triggerRule(["NameOfYourRule"]); }); // Enhanced Rich text fields var initialRteVal = getFieldValue("NameOfYourMultilineField").replace(/<[^>]*>/g,""); $("#dffs_NameOfYourMultilineField div.ms-rtestate-write").on("blur",function(){ var currVal = getFieldValue("NameOfYourMultilineField").replace(/<[^>]*>/g,""); if(currVal !== initialRteVal){ spjs.dffs.triggerRule(["NameOfYourRule"]); } });
Replace “NameOfYourMultilineField” with the name of your field, and “NameOfYourRule” with the “Rule friendly name” of your rule.
Alexander
-
March 1, 2017 at 20:35 #15957
I want to use this to hide blank multi-line text fields in an Edit form. I think I need some code to go in the “()” after function in the JS script that sets the condition for triggering this rule as “is not equal to [blank]”… is that correct? if so can you give me the code for that?
-
March 3, 2017 at 20:16 #15984
I’m not sure I understand exactly what you mean, but you can add this code to your EditForm Custom JS to hide and empty multiline plain text field:
if(getFieldValue("MultilinePlainText").length === 0){ $("#dffs_MultilinePlainText").hide(); }
Change “MultilinePlainText” with your field name.
If you have a rich text input you can hide it like this.
if($(getFieldValue("MultilineRich")).text().replace(/\u200B/g,"").length === 0){ $("#dffs_MultilineRich").hide(); }
Change “MultilineRich” with your field name.
Alexander
-
May 10, 2017 at 14:40 #16522
Hi,
does this work for multilookup fields as well?
Thanks
BR
Nicole -
May 11, 2017 at 21:06 #16543
No, but it would be possible to do it in a similar way. How would you use the trigger?
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.