Skip Navigation

[Resuelto] Displaying select list conditionally based on generic field

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created hace 7 años. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Christian Cox hace 6 años, 11 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#591061

I have a post-type called "Ads" with two taxonomies: "Philosophies" and "Subjects". I would like to display the philosophies as checkboxes (this is working fine) but I want to display the subjects in a single-select drop-down only IF the user wishes to tag a subject to the ad they are posting. However, whenever they select "Subject-Specific" (see below) the subjects drop-down box does not appear. All of my other conditional statements work on the form except this one, I can't figure out what I'm doing wrong, and any support would be greatly appreciated. It's the only field where I use a generic field but I wanted to use a generic field because there is no reason to store the data on this particular field - it's just there to toggle displaying the subjects drop-down. Here is my code:

<div class="form-group">
<label>Subject</label>
[cred_generic_field field='tag-a-subject' type='select' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":[],
"options":[
{"value":"No","label":"Not Subject-Specific"},
{"value":"Yes","label":"Subject-Specific"}
]
}
[/cred_generic_field]
[cred_show_group if="($(tag-a-subject) eq 'Yes' )" mode='fade-slide']
[cred_field field='subject' display='select' single_select=true output='bootstrap']
[/cred_show_group]
</div>

#591286

Hi, it's possible to use generic fields in CRED conditional groups, and it looks like your code is set up correctly. So I suspect something else is going on. Can you check the following:
- Be sure you have the cred_field 'form_messages' included in your form content.
- Open the browser console and watch for any JavaScript errors that may appear when you select an option in your generic field.
- Remove the conditional entirely and confirm that the subject select field appears as expected.
- Make sure your Toolset plugins are all up-to-date.

Let me know the results and we can go from there.

#593974
temp.jpg

Hi Christian,

Sorry for not realizing you posted a response (I must have missed an e-mail notification). It actually appears the form has decided to work all on it's own! I'm guessing it's because of a change we made on the server to address another form that was also having issues since that's the only thing I can think of that would have changed. However, when I opened up the browser console as you suggested I did see the attached error messages appearing. Can you tell me if this is normal or something I should look further into? As an FYI, I was viewing the page in preview mode from the Post Forms editor screen.

Thanks again for the help.

- Aaron

#594819

These error messages are not normal, and mostly seem to be related to CORS policies and content-header restrictions configured on your server. The last one that deals with jQuery validate could be relevant here, but it's difficult to say with the other errors in place.

El foro ‘Types Community Support’ está cerrado y no se permiten nuevos debates ni respuestas.