Skip Navigation

[Resolved] Categorie and numbers field

This support ticket is created 6 years 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years ago.

Assisted by: Nigel.

Author
Posts
#1185716
Categorie and number field.png

hello toolset,
I am working on a price overview in a form.
However, I run into a problem.
I would like to show the categories and when there is being checked and a number field comes where you need to fill in the amount that falls into that category.

example:
When I see the data, I do not see the number field yet,
I check the 5-10 dollars, the numbers field will appear in which a number between 5-10 dollars.

so i have 4 categories that work with 4 other numbers field which have the conditional of the rules that the amount must be beweteen the categogy.

How do i make this conditional in the checkfields?

Thnx

New threads created by Nigel and linked to this one are listed below:

https://toolset.com/forums/topic/split-how-to-validate-numeric-fields-within-a-certain-range/

#1185795

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ramon

There are two parts to what you are describing:

1. conditionally display the number field inputs depending on what is selected in the taxonomy checkbox
2. validate the number fields

Let me describe the first part here.

If this is for front-end Forms you need to use conditional display groups, which are described here: https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

That documentation refers to adding conditions based upon the values of other fields in the form, rather than taxonomies. It does also work for taxonomies, but the GUI doesn't allow you to insert such tests, you will need to enter them manually. (We have an internal ticket to improve this, but that work is not done yet.)

If your taxonomy is being displayed as checkboxes then the value you need to test against is the term name.

Here in my test site I have a taxonomy called "Range" which has terms "Low", "Medium", and "High", and the number fields "Low number", "Medium number", and "High number" will be hidden unless the appropriate range is checked, using the cred_show_group shortcodes.

Here is the relevant part of my form:

	<div class="form-group">
		<label>Ranges</label>
		[cred_field field="range" force_type="taxonomy" output="bootstrap" display="checkbox"]
	</div>

	[cred_show_group if="( $(range) eq 'Low' )" mode="fade-slide"]
	<div class="form-group">
		<label>Low number</label>
		[cred_field field="low-number" force_type="field" class="form-control" output="bootstrap"]
	</div>
	[/cred_show_group]

	[cred_show_group if="( $(range) eq 'Medium' )" mode="fade-slide"]
	<div class="form-group">
		<label>Medium number</label>
		[cred_field field="medium-number" force_type="field" class="form-control" output="bootstrap"]
	</div>
	[/cred_show_group]

	[cred_show_group if="( $(range) eq 'High' )" mode="fade-slide"]
	<div class="form-group">
		<label>High number</label>
		[cred_field field="high-number" force_type="field" class="form-control" output="bootstrap"]
	</div>
	[/cred_show_group]

As I say, you need to enter the conditional shortcodes manually, although they are functional.

That should solve the first part of your question.

In the support forum we have a policy of addressing one issue per thread, which helps organise the forum and make it easier for other users to find answers to related problems, so I will split this thread and answer the second question there.