Sauter la navigation

[Résolu] Generic fields not appearing in forms

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Now I need to include some generic "select" fields and populate the options using a View.

Solution:

Yes, it is possible within Toolset, see details here:

https://toolset.com/forums/topic/generic-fields-not-appearing-in-forms/#post-1213601

Relevant Documentation:

This support ticket is created Il y a 5 années et 9 mois. 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)

Marqué : 

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par alexG-4 Il y a 5 années et 9 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1213489

I've set up some forms and they are working fine.

Now I need to include some generic "select" fields and populate the options using a View. I figured out all this and created the view and all.... but I can't get the generic fields to appear on the form!

It must be something basic, but I can't see what.

Here's a video showing the problem:

lien caché

And here's the HTML output of the top part of the form, up to the first <hr>

<form id="cred_form_110_1" class="cred-form cred-keep-original" action="/?page_id=158&preview=true&_tt=1552432547" method="post" data-bind="with: cred_form_context_6251">
<div class="container-fluid">
	<div class="row">
		<div class="col-sm-12">
			<label>Select A Topic</label>
			
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12">
			<label>Enter Single Line Of Something</label>
			
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12">
			<hr>
		</div>
#1213593

Thanks for the details, I can login into your website, will update here if there is anything found.

#1213601

Here are what I found:
1) The generic "select" field issue, it seems to be an issue of new GUI of Toolset form, but I have tried it in your website:
Remove and recreate the generic "select" field again, it seems to work fine.

2) populate the options of generic "select" field using a View, there are some problem in your codes, please check it here:
lien caché
In section "Loop Editor", I have modified the codes from:

		<!-- [wpv-post-body view_template="loop-item-in-topics-all"] -->
      [wpv-item index=1]{"value":"[wpv-post-title]","label":""}[wpv-item index=other],{"value":"[wpv-post-title]","label":""}

To:

[wpv-item index=1]{"value":"[wpv-post-id]","label":"[wpv-post-title]"}[wpv-item index=other],{"value":"[wpv-post-id]","label":"[wpv-post-title]"}

Two problems:
a) there should not be other HTML codes in the view's output, this line need to be removed:
<!-- [wpv-post-body view_template="loop-item-in-topics-all"] -->

b) I assume you are going to display the post title as option title, and post ID as option value, it should be setup as I mentioned above:
{"value":"[wpv-post-id]","label":"[wpv-post-title]"}

And when I switched the form content to expert mode, some field settings were lost, please restore them back manually.

#1213689

Thanks, Luo

There still seems to be something wrong with the display of the generic select field.

The original field is working fine, but when I create a new field, either on the same form or on a new form, it still doesn't appear.

Also, the input area of the generic select field is transparent, so when the form is displayed on a coloured background, the background shows through. I could fix this with css, but I assume this is a symptom of the overall problem.

You can see all this on the Test Page on my site.

Thanks

#1214030
generic-field.JPG

I seems that you have changed your website, and added some custom codes.

I have done below modification in your website:
1) Edit the Toolset post form "Funnel New - Test", in section "Form Editor", edit the generic select field, add "topics-lookup" in input box "Field Slug"

2) Dashboard-> Toolset-> Settings-> Custom codes, deactivate item "Views Viewable By", and test it in front-end, it works fine, see screenshot: generic-field.JPG

It is your custom PHP codes produced the problem, it will output "No items found" for logged-in user "SupportAdmin327".

If you need assistance to setup the custom codes, new ticket please. thanks

#1214339

Thanks, Luo.

In fact, the issue with the custom code "Views Viewable By" was masking the real problem.

The dropdown was showing when I used the shortcode for one post-type, but not when I used an 'identical' shortcode for a different post type. That was true whether or not the code "Views Viewable By" was enabled.

But when I checked more closely, the working View had the checkbox "Disable the wrapping DIV around the View" ticked, whereas the non-working View didn't have it ticked.

Now they both work fine!

My issue is resolved now. Thank you!