Restored the function to stop the edit samples form from getting submitted when return key is pressed. This is needed in this form as the barcode scanner (when in keyboard emulation mode) may send a return key appended to the scanned barcode string.

This commit is contained in:
Ramkrishna Chakrabarty
2010-11-15 15:38:44 -05:00
parent 1d9b048c1c
commit dec7e64355
2 changed files with 13 additions and 1 deletions
@@ -68,7 +68,7 @@ def update_sample_state( message ):
api_key = get_value(dom, 'api_key')
log.debug('Barcode: ' + barcode)
log.debug('State: ' + state)
log.debug('api_key: ' + api_key)
log.debug('API Key: ' + api_key)
# validate
if not barcode or not state or not api_key:
log.debug( 'Incomplete sample_state_update message received. Sample barcode, desired state and user API key is required.' )
@@ -14,6 +14,18 @@
${common_javascripts()}
</%def>
<script type="text/javascript">
// This function stops the form from getting submitted when return key is pressed
// This is needed in this form as the barcode scanner (when in keyboard emulation mode)
// may send a return key appended to the scanned barcode string.
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = stopRKey
</script>
<%
from galaxy.web.framework.helpers import time_ago