Hi All,
How to save a values and display that values into rule input by a!foreach loop?
for example : in a!foreach loop there is a condition that text1 is having a datatype "string" value. I want to dynamically populate text fields in a form layout interface. How to save the user response?
a!forEach( local!data, if(fv!item.text1= "String",{ a!textField( label: fv!item.text1, labelPosition: "ABOVE", saveInto: {}, refreshAfter: "UNFOCUS", )
})
)
Please guide me how to achieve it for version 21.1.
Discussion posts and replies are publicly visible
Hi Yash, Could you please explain your use case? i am not able to understand what do you want to achieve exactly.
Hi Gopal, I want to dynamically populate text fields in a form layout interface. How to save the user response
Hi Yash, If you are using a!foreach then to save these values , you would need to create your rule input as type of array, then using fv!index you can save the values. Please see below sample example,
a!localVariables( local!data:{"value1","value2"}, a!forEach( items: local!data, expression: { a!textField( label: "text field" & fv!index, value: fv!item, saveInto: { fv!item, a!save(ri!data[fv!index],save!value) } ) } ) )
my rule input here is array type. I hope it helps.
thank you