Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Form - Select: how to dynamically add options in the frontend?

Started by Muut Archive 9 years ago · 0 replies · 931 views
9 years ago

I'm currently designing a page to register for some events. For each event there are multiple dates. For each Event i have a file with the corresponding events.
I already got a page for each event that grabs the available dates from the file, now i want to create a form so that people can register for the date they want. How can i get grav to create a select field with the corresponding options without having to enter them myself?
I tried writing a plugin with a simple function and having the select field "data-options@:" value call that function. As i did not know if my plugin or my function call was wrong I tried it with an existing function:
data-options@: '\Grav\Common\Utils::dateFormats'
still the select field does not get populated.
What am i doing wrong?
Is it maybe possible to edit it with twig in the page?
(as in somewhat like set field.options = whatever) ?

👍 2

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1321 9 years ago
Archive · by Muut Archive, 9 years ago
2 916 9 years ago
Archive · by Muut Archive, 9 years ago
2 4047 9 years ago
Archive · by Muut Archive, 9 years ago
1 2921 9 years ago
Archive · by Muut Archive, 9 years ago
3 1105 9 years ago