phone number should be optional on add new portfolio member form
This commit is contained in:
parent
ec794abbf2
commit
e6fd32f612
@ -25,6 +25,7 @@ export default {
|
|||||||
},
|
},
|
||||||
paragraph: String,
|
paragraph: String,
|
||||||
noMaxWidth: String,
|
noMaxWidth: String,
|
||||||
|
optional: Boolean,
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
@ -82,7 +83,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onBlur: function(e) {
|
onBlur: function(e) {
|
||||||
|
if (!(this.optional && e.target.value === "")) {
|
||||||
this._checkIfValid({ value: e.target.value.trim(), invalidate: true })
|
this._checkIfValid({ value: e.target.value.trim(), invalidate: true })
|
||||||
|
}
|
||||||
this.value = e.target.value.trim()
|
this.value = e.target.value.trim()
|
||||||
|
|
||||||
if (this.validation === 'dollars') {
|
if (this.validation === 'dollars') {
|
||||||
@ -97,6 +100,8 @@ export default {
|
|||||||
|
|
||||||
if (!this.modified && this.initialErrors && this.initialErrors.length) {
|
if (!this.modified && this.initialErrors && this.initialErrors.length) {
|
||||||
valid = false
|
valid = false
|
||||||
|
} else if (this.optional && value == "") {
|
||||||
|
valid = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.modified) {
|
if (this.modified) {
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
disabled=False,
|
disabled=False,
|
||||||
initial_value='',
|
initial_value='',
|
||||||
classes='',
|
classes='',
|
||||||
noMaxWidth=False) -%}
|
noMaxWidth=False,
|
||||||
|
optional=False) -%}
|
||||||
|
|
||||||
<textinput
|
<textinput
|
||||||
v-cloak
|
v-cloak
|
||||||
@ -23,6 +24,7 @@
|
|||||||
{% if noMaxWidth %}no-max-width='true'{% endif %}
|
{% if noMaxWidth %}no-max-width='true'{% endif %}
|
||||||
{% if initial_value or field.data is not none %}initial-value='{{ initial_value or field.data }}'{% endif %}
|
{% if initial_value or field.data is not none %}initial-value='{{ initial_value or field.data }}'{% endif %}
|
||||||
{% if field.errors %}v-bind:initial-errors='{{ field.errors | list }}'{% endif %}
|
{% if field.errors %}v-bind:initial-errors='{{ field.errors | list }}'{% endif %}
|
||||||
|
v-bind:optional={{ optional|lower }}
|
||||||
key='{{ field.name }}'
|
key='{{ field.name }}'
|
||||||
inline-template>
|
inline-template>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
{{ TextInput(member_form.email, validation='email') }}
|
{{ TextInput(member_form.email, validation='email') }}
|
||||||
</div>
|
</div>
|
||||||
<div class='form-col form-col--half'>
|
<div class='form-col form-col--half'>
|
||||||
{{ TextInput(member_form.phone_number, validation='usPhone') }}
|
{{ TextInput(member_form.phone_number, validation='usPhone', optional=True) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='form-row'>
|
<div class='form-row'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user