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?
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?
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);
This works, thank you very much. How to get forcontrolid and id though?
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
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
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('
');
for (let j = 0; j < multilineText.length; j++){
if (itemString[0].trim() == multilineText[j]){
isDuplicate = 1;
hasDuplicate = 1;
duplicatedItems = duplicatedItems + itemString[0].trim() + "
";
break;
}
if (isDuplicate == 1){
break;
}
}
});
if (isDuplicate == 0){
newString = newString + itemString[0].trim();
if (i != arrayItems.length - 1){
newString = newString + "
";
}
}
}
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?
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.