ryanb / nested_form

Rails plugin to conveniently handle multiple models in a single form.
MIT License
1.79k stars 505 forks source link

How to add fields programaticaly? #329

Closed USvER closed 6 years ago

USvER commented 9 years ago

I want to add nested form fields using javascript and populate it with data... How to do this?

I need to generate dom from blueprint, and then using jquery replace some values... But i don't know how...

drakmail commented 9 years ago

See source around https://github.com/ryanb/nested_form/blob/master/vendor/assets/javascripts/jquery_nested_form.js#L2 , maybe this help.

svensson-david commented 6 years ago

There's a good starting point added to the wiki for anyone looking for this https://github.com/ryanb/nested_form/wiki/How-To:-Add-fields-with-pre-defined-values

USvER commented 6 years ago

@svensson-david yeah, that is what i did... Added event listener and change value from there...