-
Notifications
You must be signed in to change notification settings - Fork 28
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
How to add a select box with dynamic fields? #127
Comments
Can't say I've tried to have dynamic select field values, but dynamic values should do the job. After all, they're just strings so I don't see why your couldn't do Note that it differs from "traditional" filters a bit. That filter essentially contains a list of functions, that turn into values when called. I'm sick at the moment so I can't help you more right now, but please post what have you tried and we'll see what's wrong. |
Hey thanks and get well soon. The problem is: that's not really dynamic. What if I have dozens of options? I would need to add them in advance. I made a shortcode to paste all the options to the select field. That seems to work - I havent tested if the values are stored within the database. Cant look into that until this evening. A filter to overwrite the options or even better - to insert new fields would be awesome. PS: is it possible to disable a form (not rendering) in case of a pre-check? Maybe via the "wplf_pre_validate_submission" action? |
That's not dynamic, but the function is. Nothing prevents you from generating the string inside a foreach loop. |
Not sure if there is a misunderstanding here. On the page with the libre form shortcode. I receive a dynamic parameter via $_REQUEST. How does the form support php/foreach loops in the backend? |
Dynamic value placeholders are transformed "at runtime", when wplf_form is called. https://github.com/libreform/wp-libre-form/blob/master/classes/class-wplf-dynamic-values.php#L19 It simply runs the dynamic value functions and replaces the placeholders with the function return values, which should be strings. |
I dont think thats what I am talking about. What I want it some like that:
becomes
|
|
Thanks for clearing up! This is very helpful. Maybe the README/doc can be extended with such examples for the future. |
We could probably add a few examples. |
Couldn't find an example how to add dynamic values to a select box.
wplf_dynamic_values doesnt seem to support it.
Any idea how I can inject the html code without using a shortcode (a temp hack)?
Thanks in advance!
The text was updated successfully, but these errors were encountered: