Dynamically add new input field

#1

Hey, guys, I was thinking about adding input field with a plus button click on form i.e user presses the ‘+’ button and an input field appears (the user can have any no. of input fields).
Can anyone please suggest me how to do it??

#2

refer this forum link…How to add text field dynamically

1 Like
#3

Thanks Rupnesh, it did work but can you explain how can i send the input value of those forms to the backend??
Like if someone created 3 more input forms using the add button how can I catch and send those values to backend??

#4
submitData() {
  let doc_name_txtvalues:any=[];
  let doc_add_txtvalues:any=[];
  let doc_cont_txtvalues:any=[];

  for(let i=0; i<=this. MySelect1.length;i++) {
    doc_name_txtvalues.push(this.doc_name[i]);
    doc_add_txtvalues.push(this.doc_add[i]);
    doc_cont_txtvalues.push(this.doc_cont[i]);
  }
  //pass the doc_name_txtvalues,doc_add_txtvalues,doc_cont_txtvalues to api.

  //or--------------------------------
  let dataarray:any=[];
  for(let i=0; i<=this. MySelect1.length;i++) {
   dataarray.push({"name":this.doc_name[i],"add":this.doc_add[i],"cont":this.doc_cont[i]});
  }
  //pass the dataarray to api.
  
}
#5

Will it work with pdfmake??
As i want the values to be printed on a pdf file.