Form with Collection linked to Select menu rendering as empty text input #5804
-
Hi all, I'm new to Statamic, and have been trying it out for a couple of potential projects. I see the potential, but have run into an issue that I can't seem to figure out or find any answers to online. It could be that I just am misunderstanding things. I am setting up a custom quote form. I have set up collections for the various options. For example, there are collections for Enclosures, UV Printing Services, and Engraving Services. The form blueprint has Collection: Entries fields set up for these, with the assumption those fields, when rendered on the front end, would populate select menus with the collection entries. What I am seeing is that when I go to the form on the front end of the site, those fields are just blank text input fields. I've tried it with Collection: Entries and Entry select mapped to the collection with the same results. If I just do a basic select field type with a couple static values, it renders the select just fine. So, something is amiss with mapping collections to select menus on my installation, it would seem. I thought maybe the starter kit I was using (Peak) was lacking some templates to render those fields, so I tried another theme with the same results. I have Statamic running on my personal cPanel server, I have run npm commands to generate the css and js files. Here is an excerpt from the form blueprint yaml ( created entirely on the front end):
I am sure I am overlooking some simple thing, but I am hoping someone here can nudge me in the right direction. Thanks! -Bret |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I don't think a select field in vanilla Statamic forms can be populated by collection entries automatically. I'm not familiar with Peak and if you are using their Forms feature you should probably ask there directly: https://github.com/studio1902/statamic-peak/discussions Having said that, it would help if you could publish your whole blueprint and your frontend template, but I think that what you're trying to do needs to happen on the frontend template, by creating the form manually and using the Collection tag. |
Beta Was this translation helpful? Give feedback.
-
Is there any reason you're using the Select fieldtype over the Entries fieldtype? |
Beta Was this translation helpful? Give feedback.
-
We only really support the "automagic" form fields on the front-end for a subset of fieldtypes. If you use the control panel to build your blueprint, you will see which ones are available. The more complex ones, like the entries fieldtype, aren't there. However, if you were to just put a non-supported field in your blueprint's yaml, as you've done, you'll just get a fallback basic input field. You can customize the html of the fields, and create your own. https://statamic.dev/tags/form-create#dynamic-rendering You may want to create an |
Beta Was this translation helpful? Give feedback.
We only really support the "automagic" form fields on the front-end for a subset of fieldtypes. If you use the control panel to build your blueprint, you will see which ones are available.
The more complex ones, like the entries fieldtype, aren't there.
However, if you were to just put a non-supported field in your blueprint's yaml, as you've done, you'll just get a fallback basic input field.
You can customize the html of the fields, and create your own.
https://statamic.dev/tags/form-create#dynamic-rendering
You may want to create an
entries.antlers.html
and in there you could have a collection tag to loop over the entries to populate a<select>
element.