How we can add multiple text fields dynamically and remove?

How we can add multiple text fields dynamically and remove?

  Discussion posts and replies are publicly visible

Parents
  • No direct approach. Better user a gridLayout() of two columns. 1st column for adding text fields and 2nd column to remove that row(image field to remove that entered text field).
    for Example:

    a!gridLayout(
    label: "Multiple Text Fields",
    headerCells: {
    a!gridLayoutHeaderCell(
    label: "Description"
    ),
    a!gridLayoutHeaderCell(
    label: ""
    )
    },
    columnConfigs: {
    a!gridLayoutColumnConfig(
    width: "DISTRIBUTE",
    weight: 3
    ),
    a!gridLayoutColumnConfig(
    width: "ICON"
    )
    },
    rows: {
    a!gridRowLayout(
    contents: {
    a!textField(
    saveInto: {},
    refreshAfter: "UNFOCUS",
    validations: {}
    ),
    a!imageField(
    images: {
    a!documentImage(
    document: a!iconIndicator(
    "REMOVE"
    ),
    link: a!dynamicLink(
    saveInto: {}
    )
    )
    },
    size: "ICON"
    )
    }
    ),

    },
    addRowLink: a!dynamicLink(
    label: "Add Item",
    saveInto: {}
    )
    )

Reply
  • No direct approach. Better user a gridLayout() of two columns. 1st column for adding text fields and 2nd column to remove that row(image field to remove that entered text field).
    for Example:

    a!gridLayout(
    label: "Multiple Text Fields",
    headerCells: {
    a!gridLayoutHeaderCell(
    label: "Description"
    ),
    a!gridLayoutHeaderCell(
    label: ""
    )
    },
    columnConfigs: {
    a!gridLayoutColumnConfig(
    width: "DISTRIBUTE",
    weight: 3
    ),
    a!gridLayoutColumnConfig(
    width: "ICON"
    )
    },
    rows: {
    a!gridRowLayout(
    contents: {
    a!textField(
    saveInto: {},
    refreshAfter: "UNFOCUS",
    validations: {}
    ),
    a!imageField(
    images: {
    a!documentImage(
    document: a!iconIndicator(
    "REMOVE"
    ),
    link: a!dynamicLink(
    saveInto: {}
    )
    )
    },
    size: "ICON"
    )
    }
    ),

    },
    addRowLink: a!dynamicLink(
    label: "Add Item",
    saveInto: {}
    )
    )

Children
No Data