Skip Navigation

[Resolved] Set the taxonomy by default when a user fill the form

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

Problem:

We want that the users who fill the basic form have their subscription taxonomy set as basic by defaults and the pro for the others.

Solution:

You can try with custom JS codes, for example:

https://toolset.com/forums/topic/set-the-taxonomy-by-default-when-a-user-fill-the-form/#post-2118555

Relevant Documentation:

https://learn.jquery.com/using-jquery-core/faq/how-do-i-check-uncheck-a-checkbox-input-or-radio-button/

This support ticket is created 3 years, 4 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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by traceM 3 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#2118535

We are making a website where the users have to fill one of the two different form based on their subscription (basic and pro). We have a subscription taxonomy for the same. We want that the users who fill the basic form have their subscription taxonomy set as basic by defaults and the pro for the others. How can we implement this ?

#2118555

Hello,

There isn't such kind of built-in feature within Toolset Forms plugin, see our document:
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_field

value. Optional. Preset value ... Does not apply to all field types, e.g. taxonomies.

As a workaround, you can try with custom JS codes, for example, your custom taxonomy field is a checkboxes field, you can edit your post form, in section "JS Editor", add below codes:

jQuery(document).on('cred_form_ready', function(){
	jQuery('input[data-value="basic"]').prop( "checked", true );
});

Please replace "basic" with your specific term's name

More help:
hidden link

#2118805

Do I need to import or add JQuery somewhere before using it in the js editor or what because I did the same thing you suggested but it's not working?

#2119483

Since it is a custom JS problem, please provide a test site with the same problem, fill website credentials in below private message box, also point out the problem page URL and form URL, I need to test and debug it in a live website, thanks

#2119693
basic.JPG

Thanks for the details, I assume we are talking about these:
1) page "Basic Provider Form":
hidden link
The JS codes work fine, I can see the option "Basic" is checked by default, see my screenshot: basic.JPG

2) page "Pro Provider Form":
hidden link
There isn't taxonomy field "Subscription" in above form, where do you want to enable the option "Pro"?

#2121907

My issue is resolved now. Thank you!