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>
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.
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
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.