Reputation: 833
I want to have a dynamic multi input form field looking like this using laravel's Bootstrapper:
http://www.bootply.com/xnSS5NtHZM
where if the user presses the plus button those 2 fields will appear again underneath. In the store()
method of my resource controller I'm saving the entire gizmo as json into the database.
I was hoping I could achieve this using (mostly) bootstrapper and simple jquery. It's not hard to do it quick and dirty but I'm trying to get a clean solution which I don't have.
Current code I have using bootstrapper:
{{
ControlGroup::generate(
Form::label('links', 'URLs'),
[
['input' => ['type' => 'text', 'link_title', 'Title']],
['input' => ['type' => 'text', 'link_value', 'URL']],
]
)
}}
Upvotes: 0
Views: 1955
Reputation: 118937
This should give you the basic concept. It uses jQuery clone method to get a copy of the HTML data and then appends it below.
http://www.bootply.com/9Jn9Uc8clj#
Upvotes: 1