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 Reply Children
  • Hi Amit,

     I am agree With you, and i have added one extra line of code for this in save into, now it's working fine.If this not proper answer,let me know.

     

    load(

     local!guests: {""},

     a!formLayout(

       label: "SAIL Example: Add "&local!guests,

       contents: {

         a!forEach(

           items: local!guests,

           expression: a!textField(

             label: if(fv!isFirst, "Guest Names", ""),

             value: fv!item,

             saveInto: {

               fv!item,

               if(

                 fv!isLast,

                 a!save(local!guests, append(local!guests, null)),

                 a!save(local!guests,remove(local!guests,fv!index))

               )

             },

             refreshAfter: "KEYPRESS"

           )

         )

       },

       buttons: a!buttonLayout(

         primaryButtons: a!buttonWidgetSubmit(

           label: "Submit"

         )

       )

     )

    )