fixed legal and radio fields continue to next on key input bug

This commit is contained in:
David Baldwynn 2017-08-02 17:45:49 -04:00
parent 53828594ff
commit a3fb15d26d
16 changed files with 60 additions and 105 deletions

View file

@ -2788,9 +2788,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.update(false, $scope.myform, false, false, function(err){
});
},
start: function(e, ui) {
console.log(ui)
}
};
/*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -24,7 +24,6 @@
ng-required="field.required"
ng-disabled="field.disabled"
placeholder="MM/DD/YYYY"
ng-focus="setActiveField(field._id, index, true)"
on-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-change="$root.nextField()">

View file

@ -1,38 +0,0 @@
<div class="field row" ng-if="form.autofillPDFs" ng-click="setActiveField(field._id, index, true)">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3>
<small class="field-number">
{{index+1}}
<i class="fa fa-angle-double-right" aria-hidden="true"></i>
</small>
{{field.title}}
<span class="required-error" ng-show="!field.required">{{ 'OPTIONAL' | translate }}</span>
</h3>
</div>
<div class="col-sm-8 field-input">
<div class="input-group ">
<div tabindex="-1" class="form-control file-caption">
<span class="file-caption-ellipsis" ng-if="!form.pdf"></span>
<div class="file-caption-name" ng-if="form.pdf">
{{field.file.originalname}}
</div>
</div>
<div class="input-group-btn">
<button type="button" ng-if="field.file" ng-click="removeFile(field);" title="Clear selected files" class="btn btn-danger fileinput-remove fileinput-remove-button">
<i class="glyphicon glyphicon-trash" ></i>
{{ 'DELETE' | translate }}
</button>
<button type="button" ng-if="field.fileLoading" title="Abort ongoing upload" class="btn btn-default" ng-click="cancelFileUpload(field)">
<i class="glyphicon glyphicon-ban-circle"></i>
{{ 'CANCEL' | translate }}
</button>
<div class="btn btn-success btn-file" ngf-select ngf-change="uploadPDF($files)" ng-if="!field.file">
<i class="glyphicon glyphicon-upload"></i>
{{ UPLOAD_FILE | translate }}
</div>
</div>
</div>
</div>
</div>

View file

@ -1,6 +1,7 @@
<div class="field row radio legal"
on-enter-or-tab-key="nextField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
on-tab-and-shift-key="prevField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field" on-valid-key="nextField()">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3>
<small class="field-number">
@ -14,20 +15,17 @@
<p class="col-xs-12">{{field.description}}</p>
</div>
<div class="col-xs-12 field-input container">
<div class="row-fluid"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()">
<div class="row-fluid">
<label class="btn col-md-5 col-xs-12"
ng-class="{activeBtn: field.fieldValue == 'true'}">
<input class="focusOn"
ng-focus="setActiveField(field._id, index, true)"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" value="true"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
ng-change="nextField()"/>
<div class="letter" style="float:left">
Y
</div>
@ -42,7 +40,7 @@
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
ng-change="nextField()"/>
<div class="letter" style="float:left">
N
</div>

View file

@ -26,7 +26,6 @@
</div>
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" class="focusOn"
ng-focus="setActiveField(field._id, index, true)"
value="{{option.option_value}}"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"

View file

@ -28,7 +28,6 @@
ng-disabled="field.disabled"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-focus="setActiveField(field._id, index, true)"
class="angular-input-stars focusOn">
</input-stars>
</div>

View file

@ -1,7 +1,6 @@
<div class="statement field row"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-focus="setActiveField(field._id, index, true)">
on-tab-and-shift-key="prevField()">
<div class="row field-title field-title">
<div class="col-xs-1"><i class="fa fa-quote-left fa-1"></i></div>
<h2 class="text-left col-xs-9">{{field.title}}</h2>
@ -13,10 +12,9 @@
<p class="col-xs-12" ng-if="field.description.length">{{field.description}} </p>
<br>
<div class="col-xs-offset-1 col-xs-11">
<button class="btn focusOn"
<button class="btn focusOn">
ng-style="{'font-size': '1.3em', 'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
ng-focused="setActiveField(field._id, index, true)"
ng-click="$root.nextField()">
ng-click="nextField()">
{{ 'CONTINUE' | translate }}
</button>
</div>

View file

@ -22,7 +22,6 @@
value="{{field.fieldValue}}"
ng-required="field.required"
ng-disabled="field.disabled"
ng-focus="setActiveField(field._id, index, true)"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
style="border: none; border-left: lightgrey dashed 2px;">

View file

@ -29,7 +29,6 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
value="field.fieldValue"
ng-focus="setActiveField(field._id, index, true)"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-required="field.required"

View file

@ -1,7 +1,9 @@
<div class="field row radio"
ng-click="setActiveField(field._id, index, true)"
on-tab-and-shift-key="prevField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field"
on-valid-key="nextField()"
ng-show="!field.disabled">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3 class="row">
<small class="field-number">
@ -26,11 +28,9 @@
class="focusOn"
style="opacity: 0; margin-left: 0px;"
ng-model="field.fieldValue"
ng-focus="setActiveField(field._id, index, true)"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-click="nextField()"
ng-disabled="field.disabled" />
ng-change="nextField()"/>
<div class="letter">
{{ 'Y' | translate }}
</div>
@ -48,14 +48,12 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
ng-disabled="field.disabled"/>
<div class="letter">
{{ 'N' | translate }}
</div>
<span>{{ 'NO' | translate }}</span>
<i ng-show="field.fieldValue === 'false'" class="fa fa-check" aria-hidden="true"></i>
ng-change="nextField()"/>
<div class="letter">
{{ 'N' | translate }}
</div>
<span>{{ 'NO' | translate }}</span>
<i ng-show="field.fieldValue === 'false'" class="fa fa-check" aria-hidden="true"></i>
</label>
</div>
</div>

View file

@ -4,24 +4,31 @@ angular.module('view-form').directive('keyToTruthy', ['$rootScope', function($ro
return {
restrict: 'A',
scope: {
field: '='
field: '=',
nextField: '&'
},
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
var truthyKeyCode = $attrs.keyCharTruthy.charCodeAt(0) - 32;
var falseyKeyCode = $attrs.keyCharFalsey.charCodeAt(0) - 32;
if(keyCode === truthyKeyCode ) {
console.log($scope);
if(keyCode === truthyKeyCode ) {
event.preventDefault();
$scope.$apply(function() {
$scope.field.fieldValue = 'true';
if($attrs.onValidKey){
$scope.$root.$eval($attrs.onValidKey);
}
});
}else if(keyCode === falseyKeyCode){
event.preventDefault();
$scope.$apply(function() {
$scope.field.fieldValue = 'false';
});
if($attrs.onValidKey){
$scope.$root.$eval($attrs.onValidKey);
}
});
}
});
}

View file

@ -26,9 +26,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.update(false, $scope.myform, false, false, function(err){
});
},
start: function(e, ui) {
console.log(ui)
}
};
/*