cancel
Showing results for 
Search instead for 
Did you mean: 
karlsanada13
Nintex Newbie

Populating a multiline textbox inside a repeated section

Jump to solution

Hello. I know that single line text this is how you do it.

NWF$('.RepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .SinglineTextbox input').val(value);

How to do it on a multiline textbox?

Labels: (2)
0 Kudos
Reply
5 Replies
Automation Master
Automation Master

Re: Populating a multiline textbox inside a repeated section

Jump to solution

You almost have it. 

Try this instead: 

NWF$('.RepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .SinglineTextbox textarea').val(value);

Or, for something that works with both Single and Multi-Line text controls, you can use: 

NWF$('.RepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .SinglineTextbox [formcontrolid][id]').val(value);
Reply
karlsanada13
Nintex Newbie

Re: Populating a multiline textbox inside a repeated section

Jump to solution

This works, thank you very much. How to get forcontrolid and id though?

0 Kudos
Reply
Automation Master
Automation Master

Re: Populating a multiline textbox inside a repeated section

Jump to solution

no no. In the second example, you don't need to get the formcontrolid or the id proper, you're just searching for a control beyond the topmost level, which has both the attributes

  • formcontrolid
  • id 

Here is a VERY SPARSE example of what the html of a Multi-line Text Control looks like: 

<div class="someUniqueClass nf-filler-control nf-filler-highlightonvalidationerror nf-resizable nf-resizable" formcontrolid="0123456789-ABCDEFGHI" data-controlname="someControlName">
  <div class="nf-filler-control-border">
    <div class="nf-filler-control-inner">
      <div class="nf-multiline">
        <textarea name="someIncrediblyLongName" id="someID" formcontrolid="0123456789-ABCDEFGHI">
          This is the text inside of a Multi-Line Text Control! Wow!
        </textarea>
      </div>
    </div>
  </div>
</div>

At the outermost level we have a <div> element with the class: "someUniqueClass". If you travel down the tree looking at the children under it, you'll eventually come to a <textarea> element with both an id attribute and a formcontrolid attribute. If we were to target that using jquery like: 

NWF$(".someUniqueClass" [formcontrolid][id]);‍‍

Which translates into "Find any element with the class of "someUniqueClass" and then look for a child element underneath of it that has both a formcontrolid and id attribute, REGARDLESS of their values". 

I hope that helps  

Reply
karlsanada13
Nintex Newbie

Re: Populating a multiline textbox inside a repeated section

Jump to solution

Thank you very much. So last question, I wanted to check for duplicate inputs. I have managed to do it but I have two another problem.

function getItemSelected(){ 
let selectedItems = NWF$("#"+calculatedSelection).val();
let arrayItems;
let result = selectedItems.slice(1,-1);
let newString = "";
arrayItems = result.split(',');
let duplicatedItems = "";
let hasDuplicate = 0;
for(let i = 0; i < arrayItems.length; i++){
let itemString = arrayItems[i].split(" -");
let isDuplicate = 0;
NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden)').each(function (){
let $row = NWF$(this);
let $textLine=$row.find('.classText textarea').val();
let multilineText = $textLine.split('\n'); 
for (let j = 0; j < multilineText.length; j++){
if (itemString[0].trim() == multilineText[j]){
isDuplicate = 1;
hasDuplicate = 1;
duplicatedItems = duplicatedItems + itemString[0].trim() + "\n";
break;
}

if (isDuplicate == 1){
break;
}
}

});
if (isDuplicate == 0){
newString = newString + itemString[0].trim();
if (i != arrayItems.length - 1){
newString = newString + "\n"; 
}
}
}
if (hasDuplicate === 1){
alert(duplicatedItems + " are already included in a row. Please remove these in the selection");
}
else{
NWF$('.vtMyRepeatingSection .nf-repeater-row:not(.nf-repeater-row-hidden):last .classText textarea').val(newString);
}
}

1) How to append texts in multiline

2) How to know which row I am currently on?

0 Kudos
Reply
Automation Master
Automation Master

Re: Populating a multiline textbox inside a repeated section

Jump to solution

I recommend starting a new topic asking this question, but with more details and perhaps screenshots that provide a better example of what it is you're trying to do / achieve. 

Parsing raw text isn't that fun or, depending on the conditions, easy. 


Reply