From 2e5bd5beb5ad938965a1175ad7eb9cd621bcef1b Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Mon, 13 Nov 2017 21:25:05 -0800 Subject: [PATCH] fixed form validation bug with radio --- public/form_modules/forms/base/css/form.css | 549 ------------------ .../submit-form.client.directive.js | 2 +- .../views/directiveViews/field/radio.html | 2 +- public/modules/forms/base/css/form.css | 4 + 4 files changed, 6 insertions(+), 551 deletions(-) delete mode 100644 public/form_modules/forms/base/css/form.css diff --git a/public/form_modules/forms/base/css/form.css b/public/form_modules/forms/base/css/form.css deleted file mode 100644 index f8dbfdf6..00000000 --- a/public/form_modules/forms/base/css/form.css +++ /dev/null @@ -1,549 +0,0 @@ -.panel-default.startPage { - border-style: dashed; - border-color: #a9a9a9; - border-width:3px; -} - -.busy-updating-wrapper { - text-align: center; - font-size: 20px; - position: fixed; - bottom: 0; - right: 55px; - z-index: 1; -} - -.busy-submitting-wrapper { - position: fixed; - top: 50%; - left: 0; - right: 0; - bottom: 0; -} - -.dropzone h4.panel-title { - height: 17px; - overflow: hidden; -} - -.container.admin-form { - margin-top: 70px; -} - -.public-form input, .public-form textarea { - background-color: #000000; - background-color: rgba(0,0,0,0); - border: 2px dashed #ddd!important; -} - -.public-form input:focus, .public-form textarea:focus { - border: 2px dashed #ddd!important; - outline: 0; -} - -/*.public-form input.no-border.ng-invalid, .public-form textarea.no-border { - border-color: none; -}*/ -.public-form input.ng-valid, .public-form textarea.ng-valid { - border-color: #20FF20!important; - border-style: solid!important; - border-width: 3px!important; -} - -.public-form input.ng-invalid.ng-dirty, .public-form textarea.ng-invalid.ng-dirty { - border-color: #FA787E!important; - border-style: solid!important; - border-width: 3px!important; -} - -section.content p.breakwords { - word-break: break-all; -} - -.btn { - border: 1px solid #c6c6c6; -} - -.btn[type='submit'] { - font-size: 1.5em; - padding: 0.35em 1.2em 0.35em 1.2em; -} - -section.content > section > section.container { - margin-top: 70px; -} - -/* -** Modal CSS Styles -*/ -.modal-header { - padding: 15px; - border-bottom: 1px solid #e5e5e5; - font-size: 18px; - font-weight: normal; -} -.input-block { - display: block; - width: 100%; -} -.modal-footer input[type='text'] { - min-height: 34px; - padding: 7px 8px; - font-size: 13px; - color: #333; - vertical-align: middle; - background-color: #fff; - background-repeat: no-repeat; - background-position: right 8px center; - border: 1px solid #ccc; - border-radius: 3px; - box-shadow: inset 0 1px 2px rgba(0,0,0,0.075); -} -.modal-body > .modal-body-alert { - color: #796620; - background-color: #f8eec7; - border-color: #f2e09a; - margin: -16px -15px 15px; - padding: 10px 15px; - border-style: solid; - border-width: 1px 0; -} - -div.form-fields { - position: relative; - padding-top: 35vh; -} -.letter { - position: relative; - display: -moz-inline-stack; - display: inline-block; - vertical-align: top; - zoom: 1; - width: 16px; - padding: 0; - height: 17px; - font-size: 12px; - line-height: 19px; - border: 1px solid #000; - border: 1px solid rgba(0,0,0,.2); - margin-right: 7px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - text-align: center; - font-weight: 700; -} - -div.form-submitted > .field.row { - padding-bottom: 2%; - margin-top: 35vh; -} -div.form-submitted > .field.row > div { - font-size: 1.7em; -} - -/* Styles for accordion */ -form .accordion-edit { - width: inherit; -} - -/*Styles for ui-datepicker*/ -.ui-datepicker.ui-widget { - z-index: 99!important; -} - -form .row.field .field-number { - margin-right: 0.5em; -} - -/* Styles for form submission view (/forms/:formID) */ -form .row.field { - padding: 1em 0 0 0; - width: inherit; -} - form .row.field > .field-title { - margin-top:0.5em; - font-size:1.2em; - padding-bottom: 1.8em; - width: inherit; - } - form .row.field > .field-input { - font-size: 1.4em; - color: #777; - } - form.submission-form .row.field.statement > .field-title { - font-size:1.7em; - } - form.submission-form .row.field.statement > .field-input { - font-size:1em; - color:#ddd; - } - - form.submission-form .select.radio > .field-input input, form.submission-form .select > .field-input input { - width:20%; - } - - form.submission-form .field.row.radio .btn.activeBtn { - background-color: rgb(0,0,0)!important; - background-color: rgba(0,0,0,0.7)!important; - color: white; - } - form.submission-form .field.row.radio .btn { - margin-right:1.2em; - } - - form.submission-form .select > .field-input .btn { - text-align: left; - margin-bottom:0.7em; - } - form.submission-form .select > .field-input .btn > span { - font-size: 1.10em; - } - - /*form.submission-form .field-input > input:focus { - font-size:1em; - }*/ - - form .field-input > textarea{ - padding: 0.45em 0.9em; - width: 100%; - line-height: 160%; - } - - form .field-input > input.hasDatepicker{ - padding: 0.45em 0.9em; - width: 50%; - line-height: 160%; - } - form .field-input > input.text-field-input{ - padding: 0.45em 0.9em; - width: 100%; - line-height: 160%; - } - form .required-error{ - color: #ddd; - font-size:0.8em; - } - - form .row.field.dropdown > .field-input input { - min-height: 34px; - border-width: 0 0 2px 0; - border-radius: 5px; - } - - form .row.field.dropdown > .field-input input:focus { - border: none; - } - - form .dropdown > .field-input .ui-select-choices-row-inner { - border-radius: 3px; - margin: 5px; - padding: 10px; - background-color: #000000; - background-color: rgba(0,0,0,0.05); - } - - form .dropdown > .field-input .ui-select-choices-row-inner.active, form .dropdown > .field-input .ui-select-choices-row-inner.active:focus { - background-color: #000000; - background-color: rgba(0,0,0,0.1); - } -.config-form { - max-width: 100%; -} - -.config-form > .row { - padding: 19px; - margin-bottom: 20px; - background-color: #f5f5f5; - border: 1px solid #e3e3e3; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); -} - -div.config-form .row.field { - padding-top:1.5em; -} - - div.config-form > .row > .container:nth-of-type(odd){ - border-right: 1px #ddd solid; - } - div.config-form.design > .row > .container:nth-of-type(odd){ - border-right: none; - } - - div.config-form .row > .field-input { - padding-left:0.1em; - } - div.config-form .row > .field-input label { - padding-left:1.3em; - display: block; - } - - -/* Styles for form admin view (/forms/:formID/admin) */ -.admin-form > .page-header { - padding-bottom: 0; - margin-bottom: 40px; -} - .admin-form > .page-header h1 { - margin-bottom: 0; - margin-top: 0; - } - .admin-form > .page-header > .col-xs-3 { - padding-top: 1.4em; - } -.admin-form .form-controls .row { - padding: 5px; -} -.admin-form .page-header { - border: none; -} - -/*Styles for admin view tabs */ -.admin-form .tab-content { - padding-top: 3em; -} - -.admin-form .panel-heading { - background-color: #f1f1f1; - position: relative!important; -} - .admin-form .panel-heading:hover { - background-color: #fff; - cursor: pointer; - } - .admin-form .panel-heading a:hover { - text-decoration: none; - } - -.current-fields .panel-body .row.question input[type='text'], .current-fields .panel-body .row.description textarea{ - width: 100%; -} -.current-fields .panel-body .row.options input[type='text'] { - width: 80%; -} - -/*Override Select2 UI*/ -.ui-select-choices.ui-select-dropdown { - top:2.5em!important; -} -.ui-select-toggle { - box-shadow:none!important; - border:none!important; -} - -.current-fields .tool-panel > .panel-default:hover { - border-color: #9d9d9d; - cursor: pointer; -} - -.current-fields .tool-panel > .panel-default .panel-heading { - background-color: #fff; - color: #9d9d9d!important; -} - .current-fields .tool-panel > .panel-default .panel-heading:hover { - background-color: #eee; - color: #000!important; - cursor: pointer; - } -.current-fields .tool-panel > .panel-default .panel-heading a { - color: inherit; -} -.current-fields .tool-panel > .panel-default .panel-heading a:hover{ - text-decoration: none; -} - -/*Styles for submission table*/ -.submissions-table .table-outer.row { - margin: 1.5em 0 2em 0!important; -} -.submissions-table .table-outer .col-xs-12 { - padding-left: 0!important; - border:1px solid #ddd; - overflow-x: scroll; - border-radius:3px; -} -.submissions-table .table > thead > tr > th { - min-width:8em; -} -.submissions-table .table > tbody > tr.selected { - background-color:#efefef; -} - -/*Styles for add fields tab*/ -.admin-form .add-field { - background-color: #ddd; - padding: 0 2% 0 2%; - border-radius: 3px; -} - .admin-form .add-field .col-xs-6 { - padding: 0.25em 0.4em; - } - .admin-form .add-field .col-xs-6 .panel-heading { - border-width: 1px; - border-style: solid; - border-color: #bbb; - border-radius: 4px; - } - -.view-form-btn.span { - padding-right:0.6em; -} -.status-light.status-light-off { - color: #BE0000; -} -.status-light.status-light-on { - color: #33CC00; -} - -/* Styles for form list view (/forms) */ -section.public-form { - padding: 0 10% 0 10%; -} -section.public-form .form-submitted { - height: 100vh; -} - -section.public-form .btn { - border: 1px solid; -} - -.form-item { - text-align: center; - border-bottom: 6px inset #ccc; - background-color: #eee; - width: 180px; - /*width:100%;*/ - position: relative; - height: 215px; - /*padding-bottom: 25%;*/ - margin-bottom: 45px; -} -.form-item.create-new input[type='text']{ - width: inherit; - color:black; - border:none; -} - -.form-item.create-new { - background-color: rgb(131,131,131); - color: white; -} - -/*CREATE-NEW FORM MODAL*/ -.form-item.new-form { - background-color: rgb(300,131,131); - z-index: 11; -} -.form-item.new-form:hover { - background-color: rgb(300,100,100); -} - .form-item.new-form input[type='text'] { - margin-top:0.2em; - width: inherit; - color:black; - border:none; - padding: 0.3em 0.6em 0.3em 0.6em; - } - .form-item.new-form .custom-select { - margin-top: 0.2em - } - .form-item.new-form .custom-select select { - background-color: white; - } - - - .form-item.new-form .details-row { - margin-top: 1em; - } - .form-item.new-form .details-row.submit { - margin-top: 1.7em; - } - .form-item.new-form .details-row.submit .btn { - font-size: 0.95em; - } - - .form-item.new-form .title-row { - margin-top: 1em; - top:0; - } - -/*Modal overlay (for lightbox effect)*/ -.overlay { - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0,0.5); - z-index: 10; -} -.overlay.submitform { - background-color: rgb(256,256,256); - background-color: rgba(256,256,256,0.8); -} -.field-directive { - z-index: 9; - padding: 10% 10% 10% 0; - border: 25px transparent solid; - position: relative; -} -.activeField { - z-index: 11; - position: relative; - background-color: transparent; -} -.activeField.field-directive { - display: inline-block; - border-radius: 7px; - width: 100%; - border: 25px transparent solid; -} - .activeField input { - background-color: transparent; - } - -.form-item:hover, .form-item.create-new:hover { - border-bottom: 8px inset #ccc; - background-color: #d9d9d9; -} - -.form-item.create-new:hover { - background-color: rgb(81,81,81); -} - -.form-item > .row.footer { - position: absolute; - bottom: 0; - left: 30%; -} - -.form-item .title-row{ - position: relative; - top: 15px; - padding-top:3em; - padding-bottom:3.65em; -} - .form-item .title-row h4 { - font-size: 1.3em; - } - -.form-item.create-new .title-row{ - padding: 0; -} - .form-item.create-new .title-row h4 { - font-size: 7em; - } - -.form-item .details-row{ - margin-top: 3.2em; -} - .form-item .details-row small { - font-size: 0.6em; - } - .form-item.create-new .details-row small { - font-size: 0.95em; - } diff --git a/public/form_modules/forms/base/directives/submit-form.client.directive.js b/public/form_modules/forms/base/directives/submit-form.client.directive.js index 5c3a809a..4e9b2b1d 100644 --- a/public/form_modules/forms/base/directives/submit-form.client.directive.js +++ b/public/form_modules/forms/base/directives/submit-form.client.directive.js @@ -197,7 +197,7 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun $scope.updateFormValidity(); $scope.$apply() if(!$scope.myform.submitted){ - SendVisitorData.send($scope.myform, newValue, TimeCounter.getTimeElapsed()); + SendVisitorData.send($scope.myform, getActiveField(), TimeCounter.getTimeElapsed()); } }); diff --git a/public/form_modules/forms/base/views/directiveViews/field/radio.html b/public/form_modules/forms/base/views/directiveViews/field/radio.html index 0c389f99..79427339 100755 --- a/public/form_modules/forms/base/views/directiveViews/field/radio.html +++ b/public/form_modules/forms/base/views/directiveViews/field/radio.html @@ -30,8 +30,8 @@ type="radio" class="focusOn" value="{{option.option_value}}" ng-model="field.fieldValue" - ng-value="field.fieldValue" ng-required="field.required" + ng-click="$root.nextField()" ng-change="$root.nextField()"/> diff --git a/public/modules/forms/base/css/form.css b/public/modules/forms/base/css/form.css index a3e97b4e..0f440500 100644 --- a/public/modules/forms/base/css/form.css +++ b/public/modules/forms/base/css/form.css @@ -34,6 +34,10 @@ form .btn { border-width: 0px; } +.public-form input[type='radio'] { + display: none; +} + form .btn { border-color: grey; }