Problem: I would like to create a generic radio field in a Form, and use a View to define the options for the field. The View does not seem to be working and the radio options are not set correctly.
Generic field shortcode with View shortcode for options:
[cred_generic_field field='organization-select-generic' type='radio'] { "required":0, "default":[], "options":[ [wpv-view name="organization-select-generic" raw="true"] ] } [/cred_generic_field]
View Loop Output editor content:
[wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <wpv-loop>{"value":"[wpv-post-id]","label":"[wpv-post-title]"},</wpv-loop>{"value":"","label":"None"} <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] [wpml-string context="wpv-views"]No items found[/wpml-string] [/wpv-no-items-found] [wpv-layout-end]
Solution: The shortcodes look okay, but there is probably some extra space in the View output that is breaking the input field options. To fix this, copy the contents of the Loop Output editor panel. Then run the Loop Wizard to create some simple loop using the loop style "List with separators". This will automatically strip extra spaces from the View's output. After you complete the wizard, overwrite everything by pasting in your original content.
Other minor things: remove the "raw" attribute from the View shortcode, and remove the "No items found" message when no results are found. Leave it blank or create a dummy radio option.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 4 years, 9 months ago.
Assisted by: Christian Cox.