Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundancy in form validation. #1

Open
PichardoWilfred opened this issue Nov 7, 2021 · 0 comments
Open

Remove redundancy in form validation. #1

PichardoWilfred opened this issue Nov 7, 2021 · 0 comments

Comments

@PichardoWilfred
Copy link
Owner

At the last steps validating inputs, in specific the select-inputs there's some redundancy.

else if (formData[element] instanceof Object) {
      //when we reach the last object
      formData[element].forEach((service) => {
        for (let element in service) {
          //if a property of said object returns undefined grab said reference and color its first children
          if (service[element] == undefined) {
            HighlightService(service.name);
            validForm = false; //  --OVER HERE--
          }
        }
      });
    }
  //validating selects
  if (formData["typeDocument"] === undefined) {
    HighlightSelect("type-document");
    validForm = false; //  --OVER HERE--
  }
  if (formData["developer"] === undefined) {
    HighlightSelect("type-developer");
    validForm = false; //  --OVER HERE--
  }

Re-structuring said parts keeping the animation code part aside from the flow-structures in code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant