Skip Navigation

[Resolved] I need to insert the value with a comma in number field

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

Last updated by aldoR 4 years ago.

Assisted by: Minesh.

Author
Posts
#1536495
Senza nome.png

I have a number field where if I enter a value with a comma (example: 12,5) it gives me an error to insert a valid numeric value. if I enter the number with the dot (ex. 12.5) it returns me as correct.
for my needs I need to insert the value with a comma, see screenshot

many thanks
Aldo

#1537081

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

There is no way to allow comma to numeric/number field.

If you really want to allow comma to your number field then the workaround I should suggest is covert your existing number field to a single-line text field that will allow you to add both number and comma - this is the only workaround I think of.
=> https://toolset.com/documentation/user-guides/custom-content/convert-existing-custom-types-and-fields-to-types-control/#converting-custom-fields

You can use the Form's API hooks like "cred_form_validate" to validate the field to check it has only numbers and comma:
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
OR
you can use the "cred_before_save_data" and remove the unwanted characters before it gets saved.
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

#1541729

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.