Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to control where a collection is rendered #640

Closed
rabol-teetrack opened this issue Mar 19, 2021 · 5 comments
Closed

Question: how to control where a collection is rendered #640

rabol-teetrack opened this issue Mar 19, 2021 · 5 comments

Comments

@rabol-teetrack
Copy link

Hi

I'm trying to figure out how to get a few collections rendered in the correct place

I have 5 fields that I would like to have in the beginning and then two collections as two rows

But I can figure out hw to get the non collection fields rendered an then the collections - the first entry of the collection is in the right place, but then when 'adding' to the collection the new entries gets added to the top of the form

I'm using the sample from the documentation

@rudiedirkx
Copy link
Collaborator

Code please. Which sample from the docs?

Maybe you just mean templates? Use templates to rearrange form fields.

@rabol
Copy link

rabol commented Mar 21, 2021

As mentioned i'm using the the code from the docs: https://kristijanhusak.github.io/laravel-form-builder/field/collection.html
in the prototype section.

Screenshot 2021-03-21 at 12 02 30

as you can see in the screenshot, the 'tags' is at the top and the 'add collection' is at the bottom. Pressing the add collection add to the top. I would have assumed that one could control where the collection is rendered, including the button

@rudiedirkx
Copy link
Collaborator

You can. It's a template. The tags field is part of the form: {!! form_row($form->tags) !!}. The button is a custom button: <button type="button" class="add-to-collection">Add to collection</button>. You decide where everything goes... I don't get it. Change the template?

@rabol
Copy link

rabol commented Mar 23, 2021

My point is more that it is difficult to figure out how it works, and the example in the doc does not work very well

@rudiedirkx
Copy link
Collaborator

Ah. I've never used or tried the docs example, so I don't know. How it works isn't so difficult, is it? You use JS to add more rows to submit. When you get it working, you're very welcome to improve the docs example.

prefer_input isn't explained very well either. Maybe the whole collection page needs an update. It's a super super useful and powerful field after all. But first your prototype example. Did you get it working? Will you PR the docs page? https://github.com/kristijanhusak/laravel-form-builder/blob/gh-pages/_posts/2015-05-24-collection.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants