Skip Navigation

[Resolved] Use toolset views inside toolset form generic field

This thread is resolved. Here is a description of the problem and solution.

Problem:
Use toolset views inside toolset form generic field

Solution:
You can use view's display mode "List with separators" which you can use to build your view's output and adjust the output as JSON format.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/use-toolset-views-inside-toolset-form-generic-field/#post-1153069

Relevant Documentation:
https://toolset.com/documentation/user-guides/view-layouts-101/#list-with-separators

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Nicholas 6 years ago.

Assisted by: Minesh.

Author
Posts
#1153016

Tell us what you are trying to do?
Hello I'd like to use toolset views inside a toolset form generic field

             [cred_field field='form_submit' value='Preview' urlparam='' class='sfc-campaign-new-button']

[cred_generic_field type='radio' field='test' class='test']
{
"required":1,
"default":[],
"options":[{"value":"1","label":"1"},{"value":"2","label":"2"},{"value":"3","label":"3"}]
}
[/cred_generic_field]

the option should come from a views shortcode. How do I have to set up the shortcode?

Is there any documentation that you are following?
https://toolset.com/forums/topic/views-inside-a-cred-generic-field/

Is there a similar example that we can see?
https://toolset.com/forums/topic/views-inside-a-cred-generic-field/

What is the link to your site?
toolkit.kununu.com

#1153069

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - With last major release of view's we added another display mode "List with separators" which you can use to build your view's output.

More info:
https://toolset.com/documentation/user-guides/view-layouts-101/#list-with-separators

To use view's with the Generic field, it needs JSON format data - so you need to format your view's loop something like:

[wpv-layout-start]
    [wpv-items-found]
    <!-- wpv-loop-start -->
        <wpv-loop>
            [wpv-item index=other]
                {"value":"[wpv-post-id]","label":"[wpv-post-title]"},
            [wpv-item index=last]
                {"value":"[wpv-post-id]","label":"[wpv-post-title]"}
        </wpv-loop>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
        <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
    [/wpv-no-items-found]
[wpv-layout-end]

And then use the view as given under:

[cred_generic_field type='radio' field='test' class='test']
{
"required":1,
"default":[],
"options":[[wpv-view name="your-view-slug"]]
}
[/cred_generic_field]

Where:
- Replace 'your-view-slug' with your view's slug

#1153102

My issue is resolved now. Thank you!