feat(user): adds validation for changes before updating user profile
This commit is contained in:
9
app/static/js/update-user-info.js
Normal file
9
app/static/js/update-user-info.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
(() => {
|
||||||
|
'use strict'
|
||||||
|
const personalInformationForm = document.querySelector('#personal-information-form');
|
||||||
|
const personalInformationSubmitBtn = personalInformationForm.querySelector('button');
|
||||||
|
personalInformationSubmitBtn.disabled = true;
|
||||||
|
personalInformationForm.oninput = function (){
|
||||||
|
personalInformationSubmitBtn.disabled = false;
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -24,7 +24,7 @@ super() }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
<h5 class="card-title">Personal information</h5>
|
<h5 class="card-title">Personal information</h5>
|
||||||
<form class="needs-validation" method="post" novalidate>
|
<form id="personal-information-form" class="needs-validation" method="post" novalidate>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="name">Name</label>
|
<label class="form-label" for="name">Name</label>
|
||||||
<input
|
<input
|
||||||
@@ -172,6 +172,7 @@ super() }}
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="{{ url_for('static', filename='js/update-user-info.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/validate-form.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/validate-form.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/passwords-match.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/passwords-match.js') }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user