Skip Navigation

[Resolved] Number field limit and calculation

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

Problem:

- I would like to have a "number" field filled in automatically according to two other fields

- I would like to limit a "number" field according to a result.

Solution:

If you are using Toolset Forms plugin to setup post forms, you can consider custom JS codes, for example:

https://toolset.com/forums/topic/number-field-limit-and-calculation/#post-2151019

Relevant Documentation:

https://api.jquery.com/change/

https://api.jquery.com/val/

This support ticket is created 3 years, 3 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 2 replies, has 2 voices.

Last updated by fatios 3 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#2150449

Hello,

Two quick questions about custom fields:
- I would like to have a "number" field filled in automatically according to two other fields
- I would like to limit a "number" field according to a result.

Let me explain :
I have a number field "width" and a number field "length".
I would like to have an "area" field which is the result of "width" x "length".
Also, I have a number field "table" and I would like the number entered to be an integer whose maximum allowed is "area"/6.

Is it possible to do all of this?

Thanks in advance

#2151019

Hello,

There isn't such kind of built-in feature within Toolset plugins.
If you are using Toolset Forms plugin to setup post forms, you can consider custom JS codes, for example:
After fill values into fields "width" and "length", trigger the custom JS codes:
hidden link
Calculate the result of "area" value, and populate the value into "area" field:
hidden link

Same as above, when user fill value into field "table", check the value if it is setup correctly

#2154223

My issue is resolved now. Thank you!