Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0sec committed Aug 28, 2023
1 parent 97cc7c5 commit e4a9a20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/components/FormValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ class FormValidator{
_hasValidInput(input){
return input.validity.valid
}

resetValidation() {
this.toggleButtonState();
this._inputElements.forEach((inputElement) => {
this._hideInputError(inputElement)
});

}

toggleButtonState(){
if(!this._getFormValidity(this._inputElements)) {
Expand Down
3 changes: 0 additions & 3 deletions src/components/PopupWithImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ class PopupWithImage extends Popup {
}

open(data) {
this._name = data.name;
this._link = data.link;

this._previewImageElement.src = data.link;
this._previewImageElement.alt = data.name;
this._previewImageCaption.textContent = data.name;
Expand Down
1 change: 1 addition & 0 deletions src/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function handleProfileEditSubmit(data) {
function handleAddCardSubmit(data){
const cardElement = createCard(data);
section.addItem(cardElement);
addCardValidator.resetValidation();
addCardPopup.close();
}

Expand Down

0 comments on commit e4a9a20

Please sign in to comment.