diff --git a/js/components/date_selector.js b/js/components/date_selector.js index 8e8f5327..cdda5276 100644 --- a/js/components/date_selector.js +++ b/js/components/date_selector.js @@ -28,6 +28,7 @@ export default { type: Boolean, default: true, }, + insetForm: Boolean, }, data: function() { @@ -36,6 +37,7 @@ export default { month: this.initialmonth, year: this.initialyear, name: this.nameTag, + showValidation: !this.insetForm, } }, @@ -160,6 +162,8 @@ export default { methods: { onInput: function(e) { + this.showValidation = true + emitEvent('field-change', this, { value: this.formattedDate, name: this.name, diff --git a/js/components/options_input.js b/js/components/options_input.js index 48213378..66e82838 100644 --- a/js/components/options_input.js +++ b/js/components/options_input.js @@ -22,6 +22,7 @@ export default { type: String, default: '', }, + insetForm: Boolean, }, created: function() { @@ -36,7 +37,7 @@ export default { const showError = (this.initialErrors && this.initialErrors.length) || false return { showError: showError, - showValid: !showError && !!this.initialValue, + showValid: !this.insetForm && (!showError && !!this.initialValue), validationError: this.initialErrors.join(' '), value: this.initialValue, } diff --git a/templates/components/date_picker.html b/templates/components/date_picker.html index 61c1889f..ca0ce59a 100644 --- a/templates/components/date_picker.html +++ b/templates/components/date_picker.html @@ -7,7 +7,8 @@ mindate=None, maxdate=None, watch=False, - optional=True) -%} + optional=True, + inset_form=False) -%} -
+
{{ label }} diff --git a/templates/components/options_input.html b/templates/components/options_input.html index b7d8d858..05416d93 100644 --- a/templates/components/options_input.html +++ b/templates/components/options_input.html @@ -1,7 +1,16 @@ {% from "components/icon.html" import Icon %} {% from "components/tooltip.html" import Tooltip %} -{% macro OptionsInput(field, tooltip, inline=False, label=True, show_validation=True, disabled=False, watch=False, optional=True) -%} +{% macro OptionsInput( + field, + tooltip, + inline=False, + label=True, + show_validation=True, + disabled=False, + watch=False, + optional=True, + inset_form=False) -%}
diff --git a/templates/components/phone_input.html b/templates/components/phone_input.html index 62a1c18a..f63e0c39 100644 --- a/templates/components/phone_input.html +++ b/templates/components/phone_input.html @@ -3,10 +3,10 @@ {% macro PhoneInput(phone_number, phone_ext, placeholder_phone="") %}
- {{ TextInput(phone_number, placeholder=placeholder_phone, validation='usPhone') }} + {{ TextInput(phone_number, placeholder=placeholder_phone, validation='usPhone', inset_form=True) }}
- {{ TextInput(phone_ext, validation='phoneExt')}} + {{ TextInput(phone_ext, validation='phoneExt', inset_form=True)}}
{%- endmacro %} diff --git a/templates/fragments/edit_user_form.html b/templates/fragments/edit_user_form.html index 56f61b80..3822271d 100644 --- a/templates/fragments/edit_user_form.html +++ b/templates/fragments/edit_user_form.html @@ -11,24 +11,24 @@
- {{ TextInput(form.first_name, validation='requiredField') }} + {{ TextInput(form.first_name, validation='requiredField', inset_form=True) }}
- {{ TextInput(form.last_name, validation='requiredField') }} + {{ TextInput(form.last_name, validation='requiredField', inset_form=True) }}
- {{ TextInput(form.email, validation='email') }} + {{ TextInput(form.email, validation='email', inset_form=True) }} {{ PhoneInput(form.phone_number, form.phone_ext) }} - {{ OptionsInput(form.service_branch) }} - {{ OptionsInput(form.citizenship) }} - {{ OptionsInput(form.designation) }} + {{ OptionsInput(form.service_branch, inset_form=True) }} + {{ OptionsInput(form.citizenship, inset_form=True) }} + {{ OptionsInput(form.designation, inset_form=True) }}
- {{ DatePicker(form.date_latest_training, mindate=mindate, maxdate=maxdate) }} + {{ DatePicker(form.date_latest_training, mindate=mindate, maxdate=maxdate, inset_form=True) }}