Commit 5cca4f27 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Errors when submitting addblock form by keypress (Bug 1336529)



Pushing enter when not on the submit or cancel buttons causes an error

Change-Id: I10a861ed5825c877a13a73a54fd4244d7bfd6cab
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent d4cbe95c
......@@ -1014,6 +1014,12 @@
$('body').append($('#addblock'));
$('#addblock').css('width', 500);
$('#addblock .cancel, #addblock .deletebutton').on('mousedown keydown', function(e) {
if (isHit(e)) {
closePositionBlockDialog(e, {'saved': false});
}
});
$('#addblock .submit').on('mousedown keydown', function(e) {
if (isHit(e)) {
var position = $('#addblock .cellchooser input:checked').val().split('-');
......@@ -1024,10 +1030,15 @@
});
}
});
$('#addblock .cancel, #addblock .deletebutton').on('mousedown keydown', function(e) {
if (isHit(e)) {
closePositionBlockDialog(e, {'saved': false});
// To allow for pushing enter button when on selecting the 'cell' column line
$('#addblock').on('keydown', function(e) {
if (e.keyCode == 13) {
var position = $('#addblock .cellchooser input:checked').val().split('-');
var order = $('#addblock_position').prop('selectedIndex') + 1;
closePositionBlockDialog(e, {
'saved': true,
'row': position[0], 'column': position[1], 'order': order
});
}
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment