Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d59ca2b3

Von Wulf Coulmann vor mehr als 13 Jahren hinzugefügt

  • ID d59ca2b3ff5c4772ec86ac14e5867cce3f64326e
  • Vorgänger 915e943a
  • Nachfolger 9c477cc8

add number calculation in number form fields

Unterschiede anzeigen:

js/common.js
48 48
  if(decpoint == thpoint) {
49 49
    return show_alert_and_focus(input_name, wrongNumberFormat);
50 50
  }
51
  if(decpoint == ',') {
52
    var decnumbers = input_name.value.split(',');
51
  var test_val = input_name.value;
52
  if(thpoint && thpoint == ','){
53
    test_val = test_val.replace(/,/g, '');
53 54
  }
54
  else {
55
    var decnumbers = input_name.value.split('.');
56
  }
57
  if(decnumbers.length == 2) {
58
    if(decnumbers[1].length > 2)  {
59
     /* return show_alert_and_focus(input_name, wrongNumberFormat); */
60
    }
55
  if(thpoint && thpoint == '.'){
56
    test_val = test_val.replace(/\./g, '');
61 57
  }
62
  else {
63
    if(decnumbers.length > 2) {
64
      return show_alert_and_focus(input_name, wrongNumberFormat);
65
    }
66
    if(!thpoint) {
67
      if(decnumbers[0].match(/\D/)) {
68
        return show_alert_and_focus(input_name, wrongNumberFormat);
69
      }
70
    }
58
  if(thpoint && decpoint == ','){
59
    test_val = test_val.replace(/,/g, '.');
71 60
  }
61

  
62
  var forbidden = test_val.match(/[^-\+\/\*\.0-9\ ]/g );
63
  if (forbidden && forbidden.length > 0 ){
64
    return show_alert_and_focus(input_name, wrongNumberFormat);
65
  } 
66

  
67
  try{ 
68
    eval(test_val);
69
  }catch(err){
70
    return show_alert_and_focus(input_name, wrongNumberFormat);
71
  } 
72

  
72 73
}
73 74

  
74 75
function check_right_date_format(input_name) {

Auch abrufbar als: Unified diff