mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-06 19:23:23 +02:00
readd js logic
This commit is contained in:
parent
5f0407251a
commit
c816cb9409
1 changed files with 9 additions and 0 deletions
|
@ -134,10 +134,19 @@ function _checkDomainAvailability(el) {
|
||||||
const callback = (response) => {
|
const callback = (response) => {
|
||||||
toggleInputValidity(el, (response && response.available), msg=response.message);
|
toggleInputValidity(el, (response && response.available), msg=response.message);
|
||||||
announce(el.id, response.message);
|
announce(el.id, response.message);
|
||||||
|
|
||||||
|
// Determines if we ignore the field if it is just blank
|
||||||
|
ignore_blank = el.classList.contains("blank-ok")
|
||||||
if (el.validity.valid) {
|
if (el.validity.valid) {
|
||||||
el.classList.add('usa-input--success');
|
el.classList.add('usa-input--success');
|
||||||
// use of `parentElement` due to .gov inputs being wrapped in www/.gov decoration
|
// use of `parentElement` due to .gov inputs being wrapped in www/.gov decoration
|
||||||
inlineToast(el.parentElement, el.id, SUCCESS, response.message);
|
inlineToast(el.parentElement, el.id, SUCCESS, response.message);
|
||||||
|
} else if (ignore_blank && response.code == "required"){
|
||||||
|
// Visually remove the error
|
||||||
|
error = "usa-input--error"
|
||||||
|
if (el.classList.contains(error)){
|
||||||
|
el.classList.remove(error)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
inlineToast(el.parentElement, el.id, ERROR, response.message);
|
inlineToast(el.parentElement, el.id, ERROR, response.message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue