Disable SaveButton if form is invalid
This commit is contained in:
parent
334f3d8ed3
commit
0e3217d3ac
@ -1,10 +1,10 @@
|
|||||||
{% macro SaveButton(text, element="button", additional_classes="", form=None) -%}
|
{% macro SaveButton(text, element="button", additional_classes="", form=None) -%}
|
||||||
{% set class = "usa-button usa-button-primary" + additional_classes %}
|
{% set class = "usa-button usa-button-primary" + additional_classes %}
|
||||||
{% if element == "button" %}
|
{% if element == "button" %}
|
||||||
<button type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed" {{ form_attr }} >
|
<button type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed || invalid" {{ form_attr }} >
|
||||||
{{ text }}
|
{{ text }}
|
||||||
</button>
|
</button>
|
||||||
{% elif element == 'input' %}
|
{% elif element == 'input' %}
|
||||||
<input type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed" value="{{ text }}" {% if form %}form="{{ form }}"{% endif %} />
|
<input type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed || invalid" value="{{ text }}" {% if form %}form="{{ form }}"{% endif %} />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user