Dear community,
I am not sure about values with thousand seperator in DHIS2, is it possible to do it with “,” . We need to customize in form ? Thanks in advance.
Dear community,
I am not sure about values with thousand seperator in DHIS2, is it possible to do it with “,” . We need to customize in form ? Thanks in advance.
If you are using custom data entry forms (HTML forms), you could:
1,000 while typing.Add this script at the bottom of your custom form HTML
function formatNumber(input) {
// Remove existing commas
let value = input.value.replace(/,/g, ‘’);
// Check if it is a number
if (!isNaN(value) && value !== ‘’) {
// Add thousand separators
input.value = Number(value).toLocaleString(‘en-US’);
}
}
function removeCommas(input) {
input.value = input.value.replace(/,/g, ‘’);
}
Attach the functions to the input field:
input type=“text”
onkeyup=“formatNumber(this)”
onchange=“removeCommas(this)”
This keeps the stored value numeric (1000) while letting users see 1,000.
I’m sure you can do it ![]()
Many thanks @HanyAly I will try and get you back the result