Home > Net >  How can i dynamically add an Input select element on click of a button in ember
How can i dynamically add an Input select element on click of a button in ember

Time:10-06

Am creating an ember application where am in need of dynamicaly adding a select element which will have options fetched from a server. so the select elements look like this.enter image description here And instead of having all dropdown boxes predefined i need to add them dynamicaly like on a click of a button like( add more). like enter image description here

and each of those drop down boxes should contain the datas that is fetched from the server. plus i need a way to get the datas from those dynamically created select fields.

my .hbs for the current drop down page is..

map.hbs

<center><h4>Map</h4></center>
<container class = "cond">
{{#each this.model.sf as |row|}}
    <select class = "sel">
        {{#each this.model.sf as |sf|}}
        <option value = {{sf.attrname}}>{{sf.attrname}}</option>
        {{/each}}
        
    </select><br>
{{/each}}

I tried ember-dynamic-fields but its depracted and I couldnt able to use it.. and all other solutions on web or for ember way older versions.. nothing works on ember 4.6 so could anyone helpout?

CodePudding user response:

Using The Platform's native FormData functionality, enter image description here

  • Related