Skip Navigation

[Resolved] Form field validation number must be above certain number

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 3 voices.

Last updated by Luo Yang 1 year, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2558677

Hello,

I have a single custom field that I am using to store a number amount for each logged-in user. I have a Toolset form displayed on the front end for each user to set the amount.

How can I set validation so the number amount must be above 40000?

I know I need to use JS for this, but I am unsure how.

Thanks for any help!

#2559143

Hello,

Yes, it is possible with custom JS codes, for example:

jQuery(document).on('cred_form_ready', function() {
  jQuery( '[name="wpcf-test-number-field"]' ).attr('min', '4000');
  jQuery( '[name="wpcf-test-number-field"]' ).attr('type', 'number');
 });

See below test site:
Login URL:
hidden link

Test page with user form:
hidden link

More helps:
hidden link

#2563083

I have a number field validation issue, as well. How do we strip out commas that are entered into a number field? We only want the number that is entered (whole integers are what we want). A code snippet would be very helpful. Also, where would we place this code for best usage?
Thanks,
Walt
P.S. Feel free to send me to the relevant documentation on data validation.

#2564243

Thanks, @luo This works great! - Now, how can we customize the validation message? I do not see this in the settings.

#2564245

Thanks, @luo. This works great! - Now, how can we customize the validation message? I do not see this in the settings.

#2564475

No, there isn't such kind of built-in feature to customize message in this case, you can add a feature request, our developer will evaluate it:
https://toolset.com/forums/topic/feature-request-css-organization-quick-find/