Comment 2 for bug 1053074

Revision history for this message
Simon Mai (simonmai) wrote :

Our libs got this issue when entering fields in workflow.
"Jumping cursor to marc record" issue has been caused by loadRecord() function whenever you filled in a fixed filed (with enough length of characters). The loadRecord() will "refresh" the below record table with the new value you just put in, and yes, after that, keep the cursor on the MARC record table. So, we want to put the cursor back to the current field we're editing, right?
Here is solution -> insert once more code line in this file: /openils.var/web/xul/rel_2_3.1/server/cat/marcedit.js
(rel_2_x.y is depending on your version)
Search this function "updateFixedFields (line 816):
   function updateFixedFields (element) {
       var grid = document.getElementById('leaderGrid');
       var recGrid = document.getElementById('recGrid');
       var new_value = element.value;
      // Don't take focus away/adjust the record on partial changes
      var length = element.getAttribute('maxlength');
      if(new_value.length < length) return true;

      var marc_rec = new MARC.Record ({ delimiter : '$', marcxml : xml_record.toXMLString() });
      marc_rec.setFixedField(element.getAttribute('name'), new_value);

      var xml_string = marc_rec.toXmlString();
      xml_record = new XML( xml_string );
      if (xml_record..record[0]) xml_record = xml_record..record[0];
      loadRecord(); //line 830

      document.getElementById(element.getAttribute('id')).select(); <== Insert this code

Save changed.
Clear cache of client, close the current client window, open the new one, and you're good to go with what you want ^^