Numbers ought to be automatically separated by commas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2023 11:16 PM
Hi everyone, I have designed a Typeform that requests project budgets from users to provide a price based on that information. The generated and budget input areas could have a sizable number of digits. It can be highly perplexing to look at these numbers without commas (especially if there is a succession of 0s0s).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 09:10 PM
sorry, I don't get your point. Please provide more information and screenshot to help us understand you better.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 10:39 PM
Hello @ karz insurance you need a onChange client script that rewrites the number with commas. Here is an example that works on my PDI
var isScriptChange = false;
function addCommas(number) {
var parts = number.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (isScriptChange) {
isScriptChange = false; // Reset the flag and exit
return;
}
isScriptChange = true;
g_form.setValue( 'u_long_number', addCommas(newValue)); // REPLACE field name with the actual field
}
Hope this helps
--
Bala Guthy
Please mark this as a solution or helpful as appropriate