Editor select field with options from HTML (or rather PHP)
Editor select field with options from HTML (or rather PHP)
I am using a custom HTML form based on the Custom form layout / templates (tags) documentation for my Editor form, however I am having trouble with select dropdown fields. The options for the select field are implemented via PHP (because it's a WordPress function), but I am not sure how I need to set up this field to let Editor know this as a field to be used with those options for selection? I'm not that good with jQuery/JS, so please bear with me
This question has an accepted answers - jump to answer
Answers
Editor has two methods for how to populate the options of a
select
:options
propertyoptions
property for the field in question.It sounds like you might be wanted to use an existing
<select>
? I'm afraid Editor doesn't have that ability. Is that right, or have I misunderstood?Thanks,
Allan
Yes, you understood correctly: I wanted to use an existing select field.
If I understand you correctly, I have to do an ajax call for getting the options from elsewhere?
I believe I got it now:
[...]
At least it shows the correct labels and values in the select field.
Yup - that will do it nicely if you can get the options via Ajax like that.
Allan