I’m using gravity form on my website and I need help to change number format on the front end form after calculation.
It’s a simple form where the user can enter a year then after simple calculation (year + 20) show them the result before submition the form.
My issue is that I need to format the number on the front end form for not having the thousands separator. (2,040 => 2040).
I’ve tried to use add_filter(
, 10, 2 ); but it’s only working for the admin.
I can not find a way to make it work.
Can someone please help me with that ?
Hi Julien. That filter is specifically for admin display, notifications and confirmations.
Can you use a single line text field instead, with the input mask of
9999. That would ensure only 4 digits could be entered there, and the number would not be formatted with the thousands separator.
Thanks for your quick answer. How do a populate the text field using the calculated data ?
Hi Julien. I’m sorry I missed the part about the calculation. To clarify, you are accepting a 4 digit year from someone, adding 20 to that, and then you want to show a 4 digit year again, without commas. Is that correct? What do you have working so far?
Here is my form https://chezpatricketmariechristine.fr/deposer-un-projet/
For now I have many fields, for some I accept a number fiels corresponding to a year then later on the form, and I want to show the user, as a reminder before he submit the form, this this number + something without the comma.
Hi Julien. After much digging, I found out it’s near impossible to leave the number alone and not add the thousands number for display. If you would like to suggest that for inclusion in the future, I recommend adding that to our product roadmap. Click the blue in the lower left on this page to add a note for our product team: