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!
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
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.
Thanks, @luo This works great! - Now, how can we customize the validation message? I do not see this in the settings.
Thanks, @luo. This works great! - Now, how can we customize the validation message? I do not see this in the settings.
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/