Navigation überspringen

[Gelöst] Set the taxonomy by default when a user fill the form

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 4 years, 10 months. 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 -

Zeitzone des Unterstützers: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von traceM vor 4 years, 10 months.

Assistiert von: Luo Yang.

Author
Artikel
#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:
versteckter 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":
versteckter 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":
versteckter 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!