Skip Navigation

[Resolved] Possible to pass extra data to generic field?

This support ticket is created 5 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1373607

I've got a view that populates a generic select field using the usual {"value":"[wpv-post-id]","label":"[wpv-post-title]"} setup.

Is it possible to send extra data to the options- something like {"value":"[wpv-post-id]","label":"[wpv-post-title]","data-slug":"[wpv-post-slug]"}

I ask because I've tried the above and it doesn't seem to work.

Thanks in advance!

#1373651

Hello,

I assume we are talking about the Toolset Forms shortcode [cred_generic_field], see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_generic_field
There isn't such kind of feature within above shortcode.

You might consider custom codes, for example in your codes, there is post ID value, so you can use it to get post's slug with PHP codes, for example, this thread:
https://wordpress.stackexchange.com/questions/11426/how-can-i-get-page-slug

More help:
https://codex.wordpress.org/Function_Reference/get_post_field