mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 05:45:02 -02:30
more validation on survey question
survey question needed to have validation that didn't allow the min/max values to overlap incorrectly and for the survey save button to be disabled if hte user is in the process of adding another question
This commit is contained in:
@@ -25,7 +25,7 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
fields: {
|
||||
question_name: {
|
||||
realName: 'question_text',
|
||||
label: 'Text',
|
||||
label: 'Name',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
@@ -55,8 +55,8 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
ngOptions: 'answer_types.name for answer_types in answer_types track by answer_types.type',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
column: 2
|
||||
|
||||
column: 2,
|
||||
ngChange: 'typeChange()'
|
||||
},
|
||||
choices: {
|
||||
realName: 'answer_options',
|
||||
@@ -80,12 +80,14 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
type: 'custom',
|
||||
control:'<div class="row">'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Minimum</span></label><input id="int_min" type="number" name="int_min" ng-model="int_min" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_min.$invalid">This is not valid integer!</div>'+
|
||||
'<label for="minimum"><span class="label-text">Minimum</span></label><input id="int_min" type="number" name="int_min" ng-model="int_min" ng-max="int_max" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_min.$error.number || survey_question_form.int_min.$error.integer">This is not valid integer!</div>'+
|
||||
'<div class="error" ng-show="survey_question_form.int_min.$error.ngMax">Too high!</div>'+
|
||||
'</div>'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Maximum</span></label><input id="int_max" type="number" name="int_max" ng-model="int_max" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_max.$invalid">This is not valid integer!</div>'+
|
||||
'<label for="minimum"><span class="label-text">Maximum</span></label><input id="int_max" type="number" name="int_max" ng-model="int_max" ng-min="int_min" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_max.$error.number || survey_question_form.int_max.$error.integer">This is not valid integer!</div>'+
|
||||
'<div class="error" ng-show="survey_question_form.int_max.$error.ngMin">Too low!</div>'+
|
||||
'</div>'+
|
||||
'</div>',
|
||||
ngShow: 'type.type==="integer" ',
|
||||
@@ -174,11 +176,16 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
}
|
||||
},
|
||||
buttons: {
|
||||
question_cancel : {
|
||||
label: 'Cancel',
|
||||
'class' : 'btn btn-default',
|
||||
ngClick: 'cancelQuestion()'
|
||||
},
|
||||
submit_question: {
|
||||
ngClick: 'submitQuestion()',
|
||||
ngDisabled: true, //'survey_question.$valid', //"!question_name || !variable || !type || ((type.type==='multiplechoice' || type.type === 'multiselect' ) && !choices)", //|| type.type===multiselect ',//'!question_name || !variable || !type' ,
|
||||
'class': 'btn btn-sm btn-primary',
|
||||
label: 'Submit Question'
|
||||
label: 'Add Question'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user