0

Any pointers gratefully received!

For Drupal 8.

I'm looking to use the image select webform element - but instead of the options being added when the webform element is created/edited we need to get the options from a content type. This is partly because we need to have extra fields available to output from the content (so JS can show/hide) - but also the editors want to be able to control when various options are available - by using 'show after' dates etc.

So - we have a content type - called vehicle - with an image field and a car group field and a 'show after' date. Ideally I'd like them to display in the same way as the current 'image select' webform element. But any way of outputting the list of vehicles as options for a webform field would be great. And I'm happy to output all the vehicles as there are not very many and the list will be further cut back by Javascript.

Thanks again!

0

This question is essentially asking the same thing as this previously answered question: Programmatically change select field options in contact form

The accepted answer in the other thread describes how to set the select list from php code. You would alter the $options in the function provided to contain your vehicle list from SQL, a yaml file, or wherever.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.