Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Changing from one form to other shows "is not focusable" error for all inputs in that form

I was trying to change form on click of button.

It worked alright but with error:

An invalid form control with name='firstName' is not focusable.

For every input present in that form.
Is there any way to get from 1 form to other without getting any error.

let formChange = document.getElementsByClassName("formChange");
let createAccSignVar = "true";
let signINForm = document.getElementsByClassName("signINForm")[0];
let signUPForm = document.getElementsByClassName("signUPForm")[0];

function toggleSignINUPForms(e) {
  signUPForm.style.display = createAccSignVar ? "none" : "block";
  signINForm.style.display = createAccSignVar ? "block" : "none";
  createAccSignVar = !createAccSignVar;
  e.preventDefault()
}
formChange[0].addEventListener("click", toggleSignINUPForms)
formChange[1].addEventListener("click", toggleSignINUPForms)
.signINForm {
  display: none;
}
<form action="#" method="post" class="signINUPForm signUPForm">
  <input type="text" name="firstName" id="firstName">
  <label for="firstName">First Name</label>

  <button class="formChange">Change to Form 2</button>
</form>
<form action="#" method="post" class="signINUPForm signINForm">
  <input type="text" name="lastName" id="lastName" placeholder=" ">
  <label for="lastName">Last Name</label>

  <button class="formChange">Change to Form 1</button>
</form>

The error was not shown in the VS code editor console but on browser console.
Here is the console Pic

Thanks for help in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!