Skip Navigation

[Gelöst] Form field validation number must be above certain number

This support ticket is created vor 1 Jahr, 9 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

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

Zuletzt aktualisiert von Luo Yang vor 1 Jahr, 9 Monaten.

Assistiert von: Luo Yang.

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

Test page with user form:
versteckter Link

More helps:
versteckter 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/