Changeset 5754


Ignore:
Timestamp:
Nov 22, 2019, 2:04:27 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #1202: Add check for duplicate barcode template in the MIPs library registration

The "Barcode template" list is unselected to begin with so that the user is forced to make a specific selection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/4.24-stable/resources/mipsprep/lib_registration.js

    r5450 r5754  
    2323    Events.addEventHandler('cleanupDate', 'blur', Wizard.validateDate);
    2424    Events.addEventHandler('libComments', 'blur', libreg.libCommentsOnChange);
     25    Events.addEventHandler('barcodeTemplate', 'change', libreg.barcodeTemplateOnChange);
    2526
    2627    // Navigation
     
    131132 
    132133    frm.barcodeTemplate.length = 0;
     134    frm.barcodeTemplate[0] = new Option('', '');
    133135    for (var i = 0; i < templates.length; i++)
    134136    {
     
    137139      frm.barcodeTemplate[frm.barcodeTemplate.length] = option;
    138140    }
    139     if (frm.barcodeTemplate.length == 0)
     141    libreg.barcodeTemplateOnChange();
     142  }
     143 
     144  libreg.barcodeTemplateOnChange = function()
     145  {
     146    var frm = document.forms['reggie'];
     147   
     148    Wizard.setInputStatus('barcodeTemplate');
     149    barcodeTemplateIsValid = false;
     150   
     151    if (frm.barcodeTemplate.length == 1)
    140152    {
    141153      Wizard.setInputStatus('barcodeTemplate', 'invalid', 'No available barcode templates');
     
    143155      return;
    144156    }
     157   
     158    if (frm.barcodeTemplate.value == '')
     159    {
     160      Wizard.setInputStatus('barcodeTemplate', 'invalid', 'A barcode template must be selected');
     161      barcodeTemplateIsValid = false;
     162      return;
     163    }
     164   
     165    barcodeTemplateIsValid = true;
    145166    Wizard.setInputStatus('barcodeTemplate', 'valid');
    146     barcodeTemplateIsValid = true;
    147167  }
    148168 
Note: See TracChangeset for help on using the changeset viewer.