Skip Navigation

[Resolved] Split: Make fields mandatory based on another field

This support ticket is created 2 years, 9 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
- 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/Karachi (GMT+05:00)

This topic contains 10 replies, has 2 voices.

Last updated by matthiasV-2 2 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2126533

Pass this ticket to Waqar, *unless you can offer a valuable solution step-by-step before Waqar comes back from vacation this friday*.

Hi Waqar,

On this page hidden link we have a 'select field' 'Ik wil het aanbod gratis bekijken'.

3. In the form we have a conditional with below fields that are required:
'Ik heb'
'straatnaam'
'huisnummer'
'woonplaats'
We want the above required fields to be 'mandatory' if the field 'Ik wil het aanbod gratis bekijken' is selected.
If the field 'Ik wil het aanbod gratis bekijken' is not selected the required fields should 'not' be mandatory.

#2127459

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

On my test website, if the required fields are added inside a conditional group, their validation is managed automatically.

If the checkbox field used in the condition is checked, the fields act as required and if that checkbox is not checked, they're no longer required.

On your website, the validation doesn't seem to be working, because of some script error in the console:
( originating from the file: /wp-content/plugins/profilegrid-user-profiles-groups-and-communities-profilegrid-instagram-integration/public/js/profilegrid-instagram-integration-public.js )


profilegrid-instagram-integration-public.js?ver=1.0.0:92 Uncaught TypeError: Cannot read property 'style' of undefined
    at showSlides (profilegrid-instagram-integration-public.js?ver=1.0.0:92)
    at profilegrid-instagram-integration-public.js?ver=1.0.0:69

I'll recommend testing validation again, after disabling the plugin "ProfileGrid - Instagram Integration". If the form's validation works as expected, you can report this script error to that plugin's official support team.

regards,
Waqar

#2128599

Waqar

We've deactivated the plugin "ProfileGrid - Instagram Integration" however the form's validation does NOT work as expected.

The required fields 'Ik heb', 'straatnaam', 'huisnummer' and 'woonplaats' are NOT marked mandatory if the field 'Ik wil het aanbod gratis bekijken' is selected.

I've sent a video to Nigel. It would be much easier if we could upload a video here.

Can we solve this issue now?

#2128907

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and I've received the screencast through Nigel.

In your browser's console, the following script error is still showing:


jquery.min.js?ver=3.6.0:2 Uncaught Error: Syntax error, unrecognized expression: #function() {
		var i=this.length,p,t;
		while (i--) {
			p = Math.floor(Math.random()*i);
			t = this[i];
			this[i]=this[p];
			this[p]=t;
		}
		return this;
	}

I'm not seeing this error on my test website, which suggests that something specific to your website is involved.

Can you please update all active plugins and the Astra theme to their latest versions and then check the form's validation again?
( there are a number of updates pending for the Toolset plugins as well )

In case the issue still persists, once everything is up-to-date, I'll need your permission to download the latest duplicator package from your website and investigate this on a test server.

Let me know how it goes.

#2128963

Waqar

Updated the plugins and theme.

The issue still persists, you have permission to download the latest duplicator package from our website and investigate this on your test server.

#2132221

Waqar

Were you able to test and fix this issue?

Can we move forward on this today?

#2132237

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting.

Your website is fairly large, but, I managed to successfully deploy its clone on my test server.

I'm not able to reproduce the issue with the required fields in the conditional field group, either on the clone or the actual website.

All four fields ( 'Ik heb', 'straatnaam', 'huisnummer' and 'woonplaats' ) now act as mandatory, when the checkbox "Ik wil het aanbod gratis bekijken" is checked.
( screenshot from the live website: hidden link )

I'm also no longer seeing any script errors in the browser's console, which explains why the fields are behaving as expected.

Looks like updating the plugins and themes worked and you're welcome to test it and let me know if you still see something out of place.

#2132283

Waqar,

Did you test for hidden link? Bacause it doesn't work on our end.

I've send a screen recording to Nigel.

#2132285

We first cleared our browser cache, so that could not cause the issue.

#2132393

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the screen recording and my tests confirm that it is a cache issue.

Here is why:

1. log in as administrator and use the form at hidden link.

The issue will be fixed.

2. Log out and use the form at hidden link

You'll see that the issue is back.

3. Now while staying logged out, visit the same page, but with some extra URL parameters, for example: hidden link

You'll see that the issue is fixed.

This confirms that the server or CDN is sending a cached copy of the web page to guests/logged-out users. When we add some extra URL parameters, it is treated as a new page and the updated web page is served.

I'll recommend clearing all involved caches and not just the browser's cache (the browser's cache is only local to a particular device).

#2132509

My issue is resolved now. Thank you Waqar!

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