Skip Navigation

[Resolved] Conditional output of Forms broken with Optimization Plugin

This thread is resolved. Here is a description of the problem and solution.

When I optimize my scripts with a plugin like Autoptimize, my Forms Conditionals stop working.

You need to exclude some scripts from optimization

Relevant Documentation:

This support ticket is created 6 years, 8 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 replies, has 2 voices.

Last updated by Beda 6 years, 8 months ago.

Assisted by: Beda.



Hello, I have a problem with conditional display of my fields.

It seems simple in the tutorial and I do everything as shown, step by step, but my conditional fields don't show up. When I set a condition to them they become hidden but they don't display when I choose the right option in the previous fields. Why? Is it a matter of some settings that I missed?

This is the form I am working on:
hidden link

As you can see there is number "3" missing, i set a condition to it. The thing is that it should display when the second option ("części samochodowe") in the previous field is chosen. It doesn't happen.

It looks like this in CRED form:

[credform class='cred-form cred-keep-original']

	[cred_field field='form_messages' value='' class='alert alert-warning']

	<div class="form-group">
		<label>1. Wybierz opcję: kupno lub sprzedaż</label>
		[cred_field field='wybierz-opcje-kupno-lub-sprzedaz' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

	<div class="form-group">
		<label>2. Wybierz rodzaj ogłoszenia</label>
		[cred_field field='wybierz-rodzaj-ogloszenia-1' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

[cred_show_group if="($(wybierz-rodzaj-ogloszenia-1) eq  '2' )"  mode='fade-slide']
<div class="form-group">
		<label>3. Wybierz rodzaj części</label>
		[cred_field field='3-wybierz-rodzaj-czesci' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

	<div class="form-group">
		<label>4. Opis ogłoszenia</label>
		[cred_field field='4-opis-ogloszenia' post='ogloszenie' value='' urlparam='' output='bootstrap']

	<div class="form-group">
		<label>5. Galeria ogłoszenia</label>
		[cred_field field='galeria-ogloszenia' post='ogloszenie' value='' urlparam='' output='bootstrap']

	<div class="form-group">
		<label>6. Cena</label>
		[cred_field field='6-cena' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

	<div class="form-group">
		<label>7. Telefon kontaktowy</label>
		[cred_field field='7-telefon-kontaktowy' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

	<div class="form-group">
		<label>8. Adres e-mail</label>
		[cred_field field='8-adres-e-mail' post='ogloszenie' value='' urlparam='' class='form-control' output='bootstrap']

	[cred_field field='form_submit' value='Wyślij' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']


Please help.


There are several JS errors in the console of that page.

Does the issue also persist with a WordPress Default Theme and NO Plugins BUT the Toolset Plugins?

If not, could you then re-enable the Plugins one after the other, and check the issue each time you enable a plugin?
Please report me when the issue comes back
It might also be due to the Theme.
Please do reactivate your Theme only after you are sure the issue isn't coming form a 3rd Party Plugin.

Thank you for your feedback



Thank you for help. This was very good advice. Now I know that issue is due to autoptimize plugin (

When JavaScript code optimization is disabled in autoptimize, everything works fine.

Now I want to enable JavaScript code optimization and set script exception. There is an option in autoptimize to exclude certain scripts from being optimized e. g. I can exclude such scripts: seal.js, js/jquery/jquery.js.

What scripts are used by Toolset that I could exclude form being optimized?

I appreciate your further help.


Can you try to exclude conditional.js located in the Toolset Common Folders?
In CRED, this is in CRED > Vendor > Toolset > Toolset-Common > Toolset-Forms > JS.

Please let me know if that works.



Your solution works. Thank you very much.

Now I have the same kind of problem but with recaptcha. On the same path in /toolset-common/ there are two recaptcha catalogs. Is the script somewhere else?


I think, the following files should be excluded too:

The rest are PHP scripts that you will not optimize.

Let me know if this solves your issue completely!



This time your solution doesn't work. I excluded all the scripts you mentioned plus this one:


Any other ideas?


I have to ask, what does not work?

reCaptcha cannot be used as a Condition, are you still having issues with conditionals?
Or is the issue that the reCaptcha is not properly loaded?

I will have to query with the DEV, in that case.



Conditionals work fine. Recaptcha is not loading. Recaptcha loads only when I turn off JS optimisation.


The CRED developer is currently in the weekend and could not fully check what files are needed.

I have to wait for his feedback, which should be due on monday.

I will advise a colleague to update you here.


recaptcha-v2/api.js is the file you need to exclude.

That is the only one.

Since we do not support optimisation or customization of Plugin Core files, if this does not work, it could be possible that you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link:

You will get the custom assistance you need to get on with your project.

Our of curiosity, do you see any console errors when you use the ReCaptcha?
Or how else does it fail?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.