Automatic comma when putting input in journal entries

HI,

When we want to enter data in the entry field, it’s better for the comma to be placed automatically between the numbers. I illustare it in the below picture

Hello @Hamed_Farahi,

Welcome to the forum.

Although I see why you find this useful, but the reason why this isn’t the case is simple, and that is to preserve the user input.

Any field that is pure white should respect this design philosophy and any field that is greyed out should respect the number format chosen by the user from Settings > Date & Number Format

The reason for this is that whatever is inside this field is the value and depending on user preferences a coma or a decimal point could by different by several orders of magnitude.

I see you already don’t use comas for your thousands separators, so if the data in the field was stored with a dot or a coma then a later change in your user preferences could potentially ruin your data.

I think this is a worthwhile usability improvement, making larger amounts easier to read and verify during entry, so I am moving it to Ideas.

Technically, numerical input and its visual formatting can be handled separately. Thousands separators can be inserted automatically as the user types, according to their selected number format, while the application stores only the numerical value. This preserves data integrity, even if the user changes their number format settings later.

With help from AI I developed a simple, safe, secure and private demo html with javascript app that shows how this can be implemented in Manager. The application is entirely self-contained within a single HTML file using vanilla JavaScript and CSS, with zero external dependencies, network requests, or database connections. User input and dynamically rendered data are handled safely using properties like textContent and standard DOM manipulation rather than unsafe raw HTML injection (innerHTML), protecting against Cross-Site Scripting (XSS). No telemetry, tracking, or data transmission occurs.

Copy the following code to a text editor like notepad or textedit and save as demo.html or similar. Click that file name it will open the browser and run the app.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Number-entry formatting demonstration</title>
<style>
  :root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #1b2d40; background: #f4f7fb; }
  * { box-sizing: border-box; }
  body { margin: 0; }
  main { max-width: 810px; margin: 30px auto; padding: 0 18px 30px; }
  .panel { background: #fff; border: 1px solid #d9e3ee; border-radius: 16px; padding: clamp(18px, 4vw, 34px); box-shadow: 0 8px 30px #162e4810; }
  h1 { font-size: clamp(1.45rem, 3.6vw, 1.85rem); line-height: 1.2; margin: 0 0 12px; }
  p { line-height: 1.55; }
  .intro { margin: 0; color: #425772; }
  .field { margin-top: 24px; }
  label, .display-label { display: block; font-weight: 650; margin: 0 0 8px; }
  select, input { width: 100%; min-width: 0; display: block; padding: 13px 14px; border: 1px solid #b1c0d2; border-radius: 9px; color: #1b2d40; background: white; font-family: inherit; }
  select { font-size: 1rem; }
  input { font-size: clamp(1.3rem, 5vw, 1.8rem); line-height: 1.4; font-variant-numeric: tabular-nums; }
  input:focus, select:focus, button:focus { outline: 2px solid #347dd4; outline-offset: 2px; }
  .sample { margin-top: 12px; padding: 12px 14px; border-radius: 9px; background: #edf4fc; }
  .sample-caption { display: block; font-size: .88rem; color: #41546d; margin-bottom: 4px; }
  .sample-value { display: block; font-size: clamp(1.2rem, 4vw, 1.48rem); font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; unicode-bidi: isolate; }
  .separator-detail { color: #425772; font-size: .89rem; margin-top: 5px; line-height: 1.5; }
  .note { margin: 8px 0 0; color: #50627b; font-size: .91rem; }
  output { display: block; padding: 14px 16px; width: 100%; min-height: 60px; border: 1px solid #d4e0eb; border-radius: 9px; background: #f2f6fa; font: 1.3rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; unicode-bidi: isolate; }
  output.empty { color: #64758b; }
  .actions { display: flex; gap: 12px; margin-top: 20px; }
  button { font: inherit; color: #23364b; background: white; border: 1px solid #aabdd2; border-radius: 8px; padding: 10px 15px; cursor: pointer; }
  button:hover { background: #edf4fc; }
  .error { color: #9b2434; font-size: .9rem; margin: 8px 0 0; }
  .error[hidden] { display: none; }
  details { margin-top: 25px; border-top: 1px solid #dae4ed; padding-top: 18px; }
  summary { font-weight: 600; cursor: pointer; }
  .details-intro { font-size: .9rem; color: #52627b; margin: 9px 0; }
  table { width: 100%; border-collapse: collapse; font-size: .91rem; }
  th { text-align: left; font-weight: 600; background: #f3f7fb; }
  th, td { padding: 9px 7px; border-bottom: 1px solid #e4ebf2; vertical-align: top; }
  td:last-child { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .footer { color: #61738b; font-size: .86rem; margin: 19px 0 0; }
  @media(max-width: 540px) {
    main { padding: 0 10px 24px; margin-top: 12px; }
    th, td { padding: 8px 5px; font-size: .82rem; }
  }
</style>
</head>
<body>
<main><section class="panel">
<h1>Number entry with automatic separators</h1>
<p class="intro">Thousands separators appear while you type. Changing the regional format changes the display, not the number itself.</p>
<div class="field">
  <label for="locale">Number format</label>
  <select id="locale">
    <option value="fr-FR">France — French</option>
    <option value="zh-CN">China — Chinese (Simplified)</option>
    <option value="ja-JP">Japan — Japanese</option>
    <option value="en-IN">India — English</option>
    <option value="en-PK">Pakistan — English</option>
    <option value="nl-NL">Netherlands — Dutch</option>
    <option value="de-CH">Switzerland — German</option>
    <option value="en-GB">United Kingdom — English</option>
    <option value="en-US">United States — English</option>
    <option value="ms-MY">Malaysia — Malay</option>
    <option value="en-NG">Nigeria — English</option>
  </select>
  <div class="sample" aria-live="polite">
    <span class="sample-caption">Regional example for the value 123456789.50</span>
    <b class="sample-value" id="example"></b>
    <div class="separator-detail" id="separators"></div>
  </div>
</div>
<div class="field">
  <label for="amount">Amount (editable)</label>
  <input id="amount" type="text" inputmode="decimal" dir="ltr" placeholder="Enter an amount" autocomplete="off" spellcheck="false" aria-describedby="entry-hint input-error">
  <p class="note" id="entry-hint"></p>
  <p id="input-error" class="error" role="alert" hidden></p>
</div>
<div class="field">
  <span class="display-label" id="stored-label">Underlying value (independent of regional formatting)</span>
  <output id="stored" class="empty" for="amount locale" aria-labelledby="stored-label" aria-live="polite">—</output>
  <p class="note">This is the decimal value that could be saved in a database DECIMAL/NUMERIC column. No separators are stored.</p>
</div>
<div class="actions"><button type="button" id="clear">Clear amount</button></div>
<details>
  <summary>Compare the regional examples</summary>
  <p class="details-intro">Each example represents the same underlying value, 123456789.50. France uses a narrow non-breaking space for grouping.</p>
  <table><thead><tr><th scope="col">Regional convention</th><th scope="col">Displayed value</th></tr></thead><tbody id="comparisons"></tbody></table>
</details>
<p class="footer">Offline browser demonstration. No database connection, no data transmission, no pre-entered amount.</p>
</section></main>
<script>
(() => {
'use strict';
const regions = [
  ['fr-FR', 'France'],
  ['zh-CN', 'China'],
  ['ja-JP', 'Japan'],
  ['en-IN', 'India'],
  ['en-PK', 'Pakistan'],
  ['nl-NL', 'Netherlands'],
  ['de-CH', 'Switzerland'],
  ['en-GB', 'United Kingdom'],
  ['en-US', 'United States'],
  ['ms-MY', 'Malaysia'],
  ['en-NG', 'Nigeria']
];
const select = document.getElementById('locale');
const input = document.getElementById('amount');
const stored = document.getElementById('stored');
const example = document.getElementById('example');
const separators = document.getElementById('separators');
const hint = document.getElementById('entry-hint');
const error = document.getElementById('input-error');
const comparisons = document.getElementById('comparisons');
const reference = '123456789.50';
let canonical = '';
let localeInfo;
let previousInput = null;

function localeMeta(locale) {
  const refFormatter = new Intl.NumberFormat(locale, {useGrouping: true, minimumFractionDigits:2, maximumFractionDigits:2});
  const parts = refFormatter.formatToParts(123456789.5);
  const group = parts.find(p => p.type === 'group').value;
  const decimal = parts.find(p => p.type === 'decimal').value;
  return {
    locale, group, decimal, refFormatter,
    integerFormatter: new Intl.NumberFormat(locale, {useGrouping: true, maximumFractionDigits:0}),
    digitMap: Array.from({length:10}, (_,i) => new Intl.NumberFormat(locale, {useGrouping:false}).format(i))
  };
}
const metas = new Map(regions.map(([locale]) => [locale, localeMeta(locale)]));
function displaySymbol(ch) {
  switch(ch) {
    case '\u202f': return 'narrow non-breaking space (U+202F)';
    case '\u00a0': return 'non-breaking space (U+00A0)';
    case ' ': return 'space (U+0020)';
    case '\u2019': return 'apostrophe (’)';
    default: return '“' + ch + '”';
  }
}
function asciiDigit(ch) {
  return /^[0-9]$/.test(ch) ? ch : null;
}
function isDecimal(ch) {
  return ch === localeInfo.decimal;
}
function isGroup(ch) {
  if (ch === localeInfo.group) return true;
  if (localeInfo.group === '\u202f' || localeInfo.group === '\u00a0' || localeInfo.group === ' ')
    return ch === ' ' || ch === '\u00a0' || ch === '\u202f';
  if (localeInfo.group === '\u2019') return ch === '\u0027';
  return false;
}
function isSemantic(ch) {
  return asciiDigit(ch) !== null || isDecimal(ch) || ch === '-' || ch === '\u2212';
}
function parseVisible(text) {
  let out = '';
  let decimalSeen = false;
  let negative = false;
  for (const ch of text) {
    const digit = asciiDigit(ch);
    if (digit !== null) out += digit;
    else if (isGroup(ch) || ch === '\u200e' || ch === '\u200f' || ch === '\u061c') continue;
    else if (isDecimal(ch) && !decimalSeen) { out += '.'; decimalSeen = true; }
    else if ((ch === '-' || ch === '\u2212') && !negative && out.length === 0) negative = true;
    else return null;
  }
  if (out === '') return negative ? '-' : '';
  const [intPart, fracPart] = out.split('.');
  const integer = (intPart || '0').replace(/^0+(?=\d)/, '');
  return (negative ? '-' : '') + integer + (decimalSeen ? '.' + (fracPart || '') : '');
}
function formatCanonical(value, meta) {
  if (value === '' || value === '-') return value;
  const negative = value.startsWith('-');
  const raw = negative ? value.slice(1) : value;
  const index = raw.indexOf('.');
  const whole = index === -1 ? raw : raw.slice(0, index);
  const frac = index === -1 ? null : raw.slice(index + 1);
  const grouped = meta.integerFormatter.format(BigInt(whole || '0'));
  const remainder = frac === null ? '' : meta.decimal + [...frac].map(d => meta.digitMap[Number(d)]).join('');
  return (negative ? '-' : '') + grouped + remainder;
}
function getStorageValue() {
  if (canonical === '' || canonical === '-') return null;
  return canonical.endsWith('.') ? canonical.slice(0, -1) : canonical;
}
function setError(message) {
  error.hidden = !message;
  error.textContent = message || '';
}
function meaningfulBefore(text, offset) {
  let n = 0;
  for (const ch of text.slice(0, offset)) if (isSemantic(ch)) n++;
  return n;
}
function caretAfterTokens(text, target) {
  if (target <= 0) return 0;
  let count = 0;
  let position = 0;
  for (const ch of text) {
    position += ch.length;
    if (isSemantic(ch) && ++count === target) return position;
  }
  return text.length;
}
function renderNumber() {
  input.value = formatCanonical(canonical, localeInfo);
  const val = getStorageValue();
  stored.textContent = val === null ? '—' : val;
  stored.classList.toggle('empty', val === null);
}
function renderLocale() {
  localeInfo = metas.get(select.value);
  // Independent native-Intl example; not derived from the input or custom formatter.
  example.textContent = localeInfo.refFormatter.format(123456789.5);
  separators.textContent = 'Thousands separator: ' + displaySymbol(localeInfo.group) + ' · Decimal separator: ' + displaySymbol(localeInfo.decimal);
  hint.textContent = 'Thousands separators appear automatically. For decimals, type ' + displaySymbol(localeInfo.decimal) + '.';
  setError('');
  renderNumber();
}
for (const [locale, name] of regions) {
  const tr = document.createElement('tr');
  const title = document.createElement('td');
  const value = document.createElement('td');
  title.textContent = name;
  value.textContent = metas.get(locale).refFormatter.format(123456789.5);
  value.setAttribute('dir', 'ltr');
  tr.append(title, value);
  comparisons.append(tr);
}
input.addEventListener('beforeinput', event => {
  previousInput = {type: event.inputType, from:input.selectionStart, to:input.selectionEnd, value: canonical};
});
input.addEventListener('input', event => {
  const typed = input.value;
  let caretTokens = meaningfulBefore(typed, input.selectionStart ?? typed.length);
  let next = parseVisible(typed);
  const type = previousInput?.type || event.inputType || '';
  if (next === null) {
    setError('Invalid punctuation for this format. Use the decimal mark shown above.');
    renderNumber();
    input.setSelectionRange(caretAfterTokens(input.value, caretTokens), caretAfterTokens(input.value, caretTokens));
    previousInput = null;
    return;
  }
  // On removal of a displayed thousands mark, also remove the adjacent digit:
  // otherwise grouping is immediately reinserted and Backspace seems broken.
  if (type.startsWith('deleteContent') && next === canonical && previousInput &&
      previousInput.from === previousInput.to && next && next !== '-') {
    const position = type === 'deleteContentBackward' ? caretTokens - 1 : caretTokens;
    if (position >= 0 && position < next.length) {
      next = next.slice(0,position) + next.slice(position+1);
      if (type === 'deleteContentBackward') caretTokens = Math.max(0, caretTokens-1);
      if (next === '-') next = '';
    }
  }
  canonical = next;
  setError('');
  renderNumber();
  const nextPosition = caretAfterTokens(input.value, caretTokens);
  input.setSelectionRange(nextPosition, nextPosition);
  previousInput = null;
});
select.addEventListener('change', renderLocale);
document.getElementById('clear').addEventListener('click', () => {
  canonical=''; renderNumber(); setError(''); input.focus();
});
renderLocale();
})();
</script>
</body>
</html>

Thank you @eko

You mentioned the main point. The idea is “making larger amounts easier to read and verify during entry”.

However, the code you made by AI, is diffcult to be understood and implanted inside the app by ordinary users.

I hope MANAGER would make a simple solution for this idea like putting it as an optional choice.

Thank you.

It is a demo code that the Manager developer could consider using. It was just to prove the point that this is possible not that Manager will implement it. I have nothing to say in that.