Skip to main content
Inspiring
July 8, 2026
Answered

Duplicate text

  • July 8, 2026
  • 1 reply
  • 15 views

Hi, I have two text fields and wish to duplicate text from "Text1" to "Text2" but only last 3 words.

    Correct answer Nesa Nurani

    You can use this as validate script of "Text1" field:

    var text = event.value ? event.value.trim() : "";

    if (text === "") {
    this.getField("Text2").value = "";}
    else {
    var words = text.split(/\s+/);
    this.getField("Text2").value = words.slice(-3).join(" ");}

     

    1 reply

    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    July 8, 2026

    You can use this as validate script of "Text1" field:

    var text = event.value ? event.value.trim() : "";

    if (text === "") {
    this.getField("Text2").value = "";}
    else {
    var words = text.split(/\s+/);
    this.getField("Text2").value = words.slice(-3).join(" ");}