Skip Navigation

[Resolved] Json data not able be import as options to cred_generic_field

This support ticket is created 4 years, 4 months 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
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 6 replies, has 3 voices.

Last updated by Christian Cox 4 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1798775

Dear Sir/Madam,

Refer to ticket https://toolset.com/forums/topic/realtime-update-the-selection/, I was able to generate a json format and put it as options in cred_generic_field before, but now I do the same and not work

Here is the page to call the Views only
hidden link (data is correctly presented in json format)

Here is the code I put in post form, I insert the [wpv-view name="json-output-competition" cached="off"] as the option

      [cred_generic_field type='select' field='this-competition-id']
{
"required":1,
"default":[],
"options":[[wpv-view name="json-output-competition" cached="off"]]
}
      [/cred_generic_field]
      <br/>[wpv-view name="json-output-competition" cached="off"]

Please visit the result from hidden link, I put the view code under the [cred_generic_field].

Here is the code for the view

[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]

I did check the checkbox for Disable the wrapping DIV around the View, if I manually copy and paste the json data to the cred options, it work.

Please advise how I can fix it.

Best regards,

Kelvin.

#1800479

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Kelvin

this is a known issue, and a patch is available until the fix is published in this erratum: https://toolset.com/errata/using-a-view-with-json-output-to-populate-generic-select-field-in-a-form-not-working/

#1803289

Dear Nigel,

Sorry I am now using the Toolset Blocks and turn on the Editing experience to Show both the legacy and Blocks interface and let me choose which to use for each item I build for keeping the Views form.

Refer to https://toolset.com/errata/using-a-view-with-json-output-to-populate-generic-select-field-in-a-form-not-working/ but I can't find folder wp-content/plugins/wp-views/application/controllers/shortcode/resolver/

Please advise whether I should place the file under /wp-content/plugins/toolset-blocks/application/controllers/shortcode/resolver

#1803445

Yes, I can confirm if you are using the Toolset Blocks plugin instead of Toolset Views, you should replace the same file in /wp-content/plugins/toolset-blocks/application/controllers/shortcode/resolver to patch the problem.

#1817561

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

This has been fixed with today's update of Views to 3.3.2 (or Blocks 1.3.2), if you could please update.

#1817713
Screenshot 2020-10-20 at 9.11.12 PM.png

Dear NIgel,

I tried but not success.

	<div class="form-group">
		<label>[cred_i18n name='gf-competition-id-label']參賽活動名稱[/cred_i18n]</label>
      [cred_generic_field type='select' field='gf-competition-id']
{
"required":1,
"default":[],
"options":[[wpv-view name="json-output-competition" cached="off"]]
}
      [/cred_generic_field]
      [wpv-view name="json-output-competition" cached="off"]
	</div>

In order to ensure the json data is queried, I added

[wpv-view name="json-output-competition" cached="off"]

before end of </div>

#1842113