Question
Dynamic Field not taking multiple inputs
Hello,
I'm trying to use a dynamic field to allow users to add more text inputs for email addresses. Currently, the email address fields all show whatever the most recent text added is--only showing the same email address in all of the boxes.
What am I doing wrong? Thank you for any help.
{
a!columnsLayout(
columns: a!columnLayout(
contents: {
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextItem(
text: "Notification Recipients",
style: "STRONG"
)
}
),
a!forEach(
items: local!emailNotify,
expression: {
a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!textField(
label: "Email Address" & " " & fv!index,
labelPosition: "COLLAPSED",
placeholder: "group@google.com",
value: ri!record['recordType!{7d9361ec-02ed-440c-bf27-394115549bf4}OPS Maintenance Notifications 2.fields.{3ceaa747-1816-40cd-af23-175364e4a157}distribution_list'],
saveInto: ri!record['recordType!{7d9361ec-02ed-440c-bf27-394115549bf4}OPS Maintenance Notifications 2.fields.{3ceaa747-1816-40cd-af23-175364e4a157}distribution_list'],
refreshAfter: "UNFOCUS",
characterLimit: 255,
validations: {
a!validationMessage(
message: "An email is required.",
validateAfter: "UNFOCUS",
showWhen: a!isNullOrEmpty(local!emailNotify)
)
}
)
),
a!sideBySideItem(
item: a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextIcon(
icon: "times",
altText: "Remove email address",
link: a!dynamicLink(
saveInto: a!save(
local!emailNotify,
remove(local!emailNotify, fv!index)
)
),
linkStyle: "STANDALONE"
)
},
showWhen: count(local!emailNotify) > 1
),
width: "MINIMIZE"
)
},
alignVertical: "MIDDLE"
)
}
),
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: a!richTextItem(
text: {
a!richTextIcon(icon: "plus", altText: "plus"),
" ",
"Add Email Address"
},
link: a!dynamicLink(
saveInto: {
a!save(
local!emailNotify,
append(local!emailNotify, " ")
)
}
),
linkStyle: "STANDALONE"
),
accessibilityText: "Clicking this link will add another email address input above."
)
},
width: "NARROW_PLUS"
)
)
},