rem: var extra     = this['extra']; 
add: var extra     = this.extra; 
context: function eob_get_error_text (err) {  var extra     = this['extra'];  var field     = err[0];  var type      = err[1];  var field_val = err[2];  var ifs_match = err[3];  var m;  var dig = (m = type.match('(_?\\d+)$')) ? m[1] : '';  var type_lc = type.toLowerCase();  /// allow for delegated field names - only used for defaults  if (field_val['delegate_error']) {    field = field_val['delegate_error'];    field = field.replace(new RegExp('\\$(\\d+)','g'), function (N) {      if (typeof(ifs_match) != 'object'          || typeof(ifs_match[N]) == 'undefined') return ''      return ifs_match[N];    });  }  /// the the name of this thing  var name = (field_val['name']) ? field_val['name'] : "The field " +field;  name = name.replace(new RegExp('\\$(\\d+)','g'), function (N) {    if (typeof(ifs_match) != 'object'        || typeof(ifs_match[N]) == 'undefined') return ''    return ifs_match[N];  });  /// type can look like "required" or "required2" or "required100023"  /// allow for fallback from required100023_error through required_error  var possible_keys = new Array(type + '_error');  if (dig.length) possible_keys.unshift(type + dig + '_error');    /// look in the passed hash or self first  for (var i = 0; i < possible_keys.length; i ++) {    var key = possible_keys[i];    var ret = field_val[key];    if (! ret) {      if (extra[key]) ret = extra[key];      else continue;    }    ret = ret.replace(new RegExp('\\$(\\d+)','g'), function (N) {      if (typeof(ifs_match) != 'object'          || typeof(ifs_match[N]) == 'undefined') return ''      return ifs_match[N];    });    ret = ret.replace(new RegExp('\\$field','g'), field);    ret = ret.replace(new RegExp('\\$name' ,'g'), name);    if (field_val[type + dig] && typeof(field_val[type + dig]) == 'string')      ret = ret.replace(new RegExp('\\$value' ,'g'), field_val[type + dig]);    return ret;  }  /// set default messages  if (type == 'required' || type == 'required_if') {    return name + " is required.";      } else if (type == 'min_values') {    var n = field_val["min_values" + dig];    var values = (n == 1) ? 'value' : 'values';    return name + " had less than "+n+" "+values+".";  } else if (type == 'max_values') {    var n = field_val["max_values" + dig];    var values = (n == 1) ? 'value' : 'values';    return name + " had more than "+n+" "+values+".";    } else if (type == 'enum') {    return name + " is not in the given list.";    } else if (type == 'equals') {    var field2 = field_val["equals" + dig];    var name2  = field_val["equals" +dig+ "_name"];    if (! name2) name2 = "the field " +field2;    name2 = name2.replace(new RegExp('\\$(\\d+)','g'), function (N) {      if (typeof(ifs_match) != 'object'          || typeof(ifs_match[N]) == 'undefined') return ''      return ifs_match[N];    });    return name + " did not equal " + name2 +".";    } else if (type == 'min_len') {    var n = field_val["min_len"+dig];    var chars = (n == 1) ? 'character' : 'characters';    return name + " was less than "+n+" "+chars+".";  } else if (type == 'max_len') {    var n = field_val["max_len"+dig];    var chars = (n == 1) ? 'character' : 'characters';    return name + " was more than "+n+" "+chars+".";  } else if (type == 'match') {    return name + " contains invalid characters.";  } else if (type == 'compare') {    return name + " did not fit comparison.";    } else if (type == 'type') {    var _type = field_val["type"+dig];    return name + " did not match type "+_type+".";      }  return alert("Missing error on field "+field+" for type "+type+dig);}
meta: 5443	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5443/36b6d6336f71148a2949342b6bf1af36a21992c1/validate.js/buggy/lib/CGI/Ex/validate.js