add: document.hide_yaml_errors = (! document.show_yaml_errors); if (location.search && location.search.indexOf('show_yaml_errors') != -1) document.hide_yaml_errors = 0; 
context: document.load_val_hash = function (form, val_hash) {  // check the form we are using  if (! form) return alert('Missing form or form name');  if (typeof(form) == 'string') {    if (! document[form]) return alert('No form by name '+form);    form = document[form];  }  // if we already have validation - use it  if (form.val_hash) return form.val_hash;  // load in the validation and save it for future use  if (typeof(val_hash) != 'object') {    // get the hash from a javascript function    if (typeof(val_hash) == 'function') {      val_hash = val_hash(formname);    } else if (typeof(val_hash) == 'undefined') {      var el;      // get hash from a global js variable      if (typeof(document.validation) != 'undefined') {        val_hash = document.validation;      // get hash from a element by if of validation      } else if (el = document.getElementById('validation')) {        val_hash = el.innerHTML;        val_hash = val_hash.replace(new RegExp('&lt;', 'ig'),'<');        val_hash = val_hash.replace(new RegExp('&gt;', 'ig'),'>');        val_hash = val_hash.replace(new RegExp('&amp;','ig'),'&');      // read hash from <input name=foo validation="">      } else {        var found = 0;        var _val_hash   = new Array();        var group_order = new Array();        var anchors     = new Array(); // hold anchors between yaml calls        var ref;        var str = form.getAttribute('validation');        if (str && (ref = document.yaml_load(str, anchors)) && ref[0]) {          _val_hash = ref[0];          if (_val_hash.length) {            alert("Inline validation may only have one group.");            return;          }          found = 1;        }        var anc;        for (var i = 0; i < form.elements.length; i ++) {          var name = form.elements[i].name;          var str  = form.elements[i].getAttribute('validation');          if (! name || ! str) continue;          str = str.replace('\\s*','');          if (anc = str.match('^\\ *&(\\w+)\\ *')) {            str = str.substring(anc[0].length);            anc = anc[1];          }          if (str.indexOf('\n') == -1)            str = str.replace(new RegExp('(\\w+:\\ +(\'[^\']*\'|"[^"]*"|[^,:]+)),\\s+','g'),'$1\n');          var ref = document.yaml_load(str,anchors);          if (! ref || ! ref[0]) continue;          var hash = ref[0];          if (! hash['field']) hash['field'] = name;          if (anc) anchors[anc] = hash;          _val_hash[name] = hash;          group_order[group_order.length] = name;          found = 1;        }        if (found) {          val_hash = _val_hash;          if (! val_hash['group order']) val_hash['group order'] = group_order;        }      }    }    if (typeof(val_hash) == 'string') {      if (! document.yaml_load) return;      //document.hide_yaml_errors = (! document.show_yaml_errors);      //if (location.search && location.search.indexOf('show_yaml_errors') != -1)      //  document.hide_yaml_errors = 0;      val_hash = document.yaml_load(val_hash);      if (document.yaml_error_occured) return;    }  }  // attach to the form  form.val_hash = val_hash;  return form.val_hash;}
meta: 5443	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5443/c04a203deff1b87cb491cd242adc30fa78fef554/validate.js/buggy/lib/CGI/Ex/validate.js