codice:
function testInput() {
  var n = document.getElementById("idInput").value;
  return n.length < 10 && /^[0-9]+,[0-9]{1,7}$/.test(n);
}
Se la parte decimale è opzionale diventa così:
codice:
function testInput() {
  var n = document.getElementById("idInput").value;
  return n.length < 10 && /^[0-9]+,?[0-9]{0,7}$/.test(n);
}