Changeset 1497


Ignore:
Timestamp:
Jan 9, 2012, 3:44:29 PM (10 years ago)
Author:
Martin Svensson
Message:

Fixes #341. Specimen tube registration wizard should check name format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/specimentube.jsp

    r1496 r1497  
    129129  if (caseName == '')
    130130  {
    131     setInputStatus('case', 'Missing', 'invalid');
     131    setInputStatus('case', 'Missing', 'invalid');   
    132132    return;
     133  }
     134  if (caseName.length != 7)
     135  {
     136    setInputStatus('case', 'Only 7-digits name is allowed .', 'invalid');
     137    frm.caseName.focus();
     138    return;
     139  }
     140  for(var i=0; i<caseName.length; i++)
     141  {
     142    var charCode = caseName.charAt(i);
     143    if (!((charCode < 32 ) ||
     144            (charCode > 45 && charCode < 47) ||
     145            (charCode > 47 && charCode < 58)))
     146    {
     147      setInputStatus('case', 'Name should only contain numbers', 'invalid');
     148      frm.caseName.focus();
     149            return;
     150        }
    133151  }
    134152  setInputStatus('case', '', 'valid');
Note: See TracChangeset for help on using the changeset viewer.