fixed key-to-option attributes

This commit is contained in:
David Baldwynn 2017-11-19 16:10:30 -08:00
parent 58380d23e3
commit a217567b9b
2 changed files with 16 additions and 7 deletions

View File

@ -182,7 +182,18 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
angular.element('#'+field_id+'.selectize-input')[0].focus();
}
});
}
} else {
if (angular.element('#'+field_id+' .focusOn').length) {
//Handle default case
angular.element('#'+field_id+' .focusOn')[0].focus();
} else if(angular.element('#'+field_id+' input').length) {
//Handle case for rating input
angular.element('#'+field_id+' input')[0].focus();
} else if(angular.element('#'+field_id+'.selectize-input').length) {
//Handle case for dropdown input
angular.element('#'+field_id+'.selectize-input')[0].focus();
}
}
};
$rootScope.$on('duScrollspy:becameActive', function($event, $element, $target){
@ -196,7 +207,6 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
$rootScope.nextField = $scope.nextField = function(){
if($scope.selected && $scope.selected.index > -1){
if($scope.selected._id !== FORM_ACTION_ID){
var currField = $scope.myform.visible_form_fields[$scope.selected.index];

View File

@ -1,14 +1,13 @@
'use strict';
angular.module('view-form').directive('keyToOption', function(){
angular.module('view-form').directive('keyToOption', ['$rootScope', function($rootScope){
return {
restrict: 'A',
scope: {
field: '='
},
link: function($scope, $element, $attrs, $select) {
$element.bind('keydown keypress', function(event) {
link: function($scope, $element, $attrs) {
$('body').on('keypress', function(event) {
var keyCode = event.which || event.keyCode;
var index = parseInt(String.fromCharCode(keyCode))-1;
@ -22,4 +21,4 @@ angular.module('view-form').directive('keyToOption', function(){
});
}
};
});
}]);