Skip to main content
Known Participant
Nov 26, 2026 12:04 PM UTC
Answered

Copy list box items

I have two list box and a button field, I want to copy selected items from first to second list box via button click

    Nesa Nurani
    Nesa NuraniCorrect answer
    Community Expert
    Nov 26, 2026 12:07 PM UTC

    You can place this in button as Mouse UP action:
     

    var f1 = this.getField("List Box1");
    var f2 = this.getField("List Box2");
    var selectedItems = f1.value;
    if (typeof selectedItems=="object") {
    for (var i in selectedItems) {
    f2.insertItemAt({cName: selectedItems[i], nIdx: -1});
    }
    } else f2.insertItemAt({cName: selectedItems, nIdx: -1});

    Change List Box1 and 2 to your actual field names.

    1 reply

    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    Nov 26, 2026 12:07 PM UTC

    You can place this in button as Mouse UP action:
     

    var f1 = this.getField("List Box1");
    var f2 = this.getField("List Box2");
    var selectedItems = f1.value;
    if (typeof selectedItems=="object") {
    for (var i in selectedItems) {
    f2.insertItemAt({cName: selectedItems[i], nIdx: -1});
    }
    } else f2.insertItemAt({cName: selectedItems, nIdx: -1});

    Change List Box1 and 2 to your actual field names.

    Translate