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

140
Views
input field setter function doesn't work after manually changing value

I need help understanding this behaviour on my php page. I have a table with data fetched from a mysql database, and each row of this table has a button like this:

<button onclick='fillform(arg1, arg2, arg3)'>+</button>

which is invoking the following js function:

function fillform(arg1, arg2, arg3){
 document.getElementById('input1').value = arg1;
 document.getElementById('input2').value = arg2;
 document.getElementById('input3').value = arg3;
}

So everytime I press the button on that specific row, the data form that row are set as value of 3 input fields on the same page.

Everything works fine, but if I manually change the value of one of the inputs, when I press the button again from any row, that specific input field is not updated anymore from the fillform() function and is stuck with the value I typed.

the input fields don't have any other attributes set beside id, so they are like this:

<input type="text" id="input1">

Is there a way to make the function have precedence or am I missing something in the code? Thanks

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!