Skip Navigation

[Resolved] CRED numeric field with comma

This support ticket is created 5 years, 8 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 5 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1210169

I want a numeric field that validates and allows commas for entering currency values. Is there a way to do that now? If not, what is the workaround you suggest?

Similar questions were asked more than 2 years ago here:

- https://toolset.com/forums/topic/cred-numeric-field-and-commas/

This suggests using a single line field instead of numeric. This would require writing our own custom validation function to allow the commas?

- https://toolset.com/forums/topic/numeric-fields-with-commas-causing-a-problem/
The user who posted this one used a jQuery plugin instead. The link to the plugin is hidden in the thread. Could you tell me which one did the user use?

#1210374

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - the numeric field do not allow comma natively and as suggested you need to use custom code to allow that.

Here are a few links that may help you:
=> https://stackoverflow.com/questions/3883342/add-commas-to-a-number-in-jquery
=> hidden link

If you do not know how to use custom JS, please feel free to contact our certified partners for your any custom programming needs:
=> https://toolset.com/contractors/

#1210424

Thanks. We're able to add commas, but were hoping there's a way to get it to work with a numeric field which otherwise would fail validation. We'll have to write a custom validation function and use a single line field instead.

I hope Toolset adds this to CRED forms in the future. It is readily available in other plugin(s) like Gravity Forms.

#1210436

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

We'll have to write a custom validation function and use a single line field instead.
-- I think this is the best alternative way. Toolset Forms offers the hook to validate the form server side. You can use the Toolset Forms hook: cred_form_validate
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

Yes - it will be a new feature and please feel free to submit new feature request using the following link:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/