added natural field

This commit is contained in:
David Baldwynn 2015-07-29 18:27:46 -07:00
parent 4be6210134
commit 6c671abd6b
5 changed files with 35 additions and 1 deletions

View file

@ -28,6 +28,7 @@ function validateFormFieldType(value) {
'checkbox',
'hidden',
'yes_no',
'natural'
];
if (validTypes.indexOf(value) > -1) {

View file

@ -28,7 +28,8 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
'legal',
'statement',
'rating',
'yes_no'
'yes_no',
'natural'
];
if (__indexOf.call(supported_fields, type) >= 0) {
return templateUrl += type + '.html';
@ -48,6 +49,14 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
defaultDate: 0,
};
}
//Set only if we have a natural lang processing field
else if(scope.field.fieldType === 'natural'){
//Fires when field is changed
scope.$watch('scope.field', function(newValue, oldValue) {
});
}
// GET template content from path
var templateUrl = getTemplateUrl(scope.field);

View file

@ -29,6 +29,8 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
};
$scope.reloadForm = function(){
timeCounter.stopClock();
timeCounter.startClock();
$scope.form.submitted = false;
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){
field.fieldValue = '';

View file

@ -63,6 +63,10 @@ angular.module('forms').service('FormFields', [
name : 'statement',
value : 'Statement'
},
{
name : 'natural',
value : 'Natural Language Input'
},
];
}

View file

@ -0,0 +1,18 @@
<div class="textfield natural field row">
<div class="col-xs-12 field-title"><h3><span class="fa fa-angle-double-right"></span> {{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3></div>
<div class="col-xs-12 field-input">
<input type="text"
class="text-field-input"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
value="field.fieldValue"
ng-required="field.required"
ng-disabled="field.disabled" changeFocus
focus-up-id="focusUpButton"
focus-down-id="focusDownButton">
</div>
<br>
<div class="col-xs-12">
<span ng-bind="field.fieldMatchValue"></span>
</div>
</div>