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

107
Views
Multiple email input fields autofilling to same value

I have a form with a variable number of email input fields. The user can click a button to add an additional email input if the wish. My form then maps out the inputs:

function renderEmailFields() {
  return [...Array(numberOfEmails).keys()].map((i) => {
    return (
      <div key={i} className={styles.inputContainer}>
         <InputValidatable
            autoFocus={true}
            className={styles.input}
            id={`supportSquadEmail-${i}`}
            isValid={Validation.isEmailAddress(inviteEmails[i])}
            name={`supportSquadEmail-${i}`}
            value={inviteEmails[i]}
            onChange={(e) => handleEmailChange(i, e)}
            placeholder="Enter email here..."
          />

 </div>
 );
});
}
const [inviteEmails, setInviteEmails] = useState(["", "", ""]);
const [numberOfEmails, setNumberOfEmails] = useState(3);

function handleEmailChange(index, e) {
   const placeHolderArray = inviteEmails;
   placeHolderArray[index] = e.target.value;
   setInviteEmails([...placeHolderArray]);
}

When I click on any of the email inputs, my Chrome browser gives my autocomplete options. Selecting one of the autocomplete options is causing ALL of the email inputs to populate with that value.

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!