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

144
Views
How can I manipulate the values on a form when the submit button is clicked

Update 2 - Solved

On reflection with Update 1 I was close to solving my problem, this is my final solution.

<button type='submit' onclick="validate()" class='btn btn-default'>Submit</button>


validate = function() {
       document.getElementById('id_Price').value="2988.99"
}

Update 1

I have had a bit more success with this -

<button type='submit' onclick="validate()" class='btn btn-default'>Submit</button>


validate = function() {
  console.log("Anything happening? (2)")

  RoomBookingsForm['Price'].value()="2988.99"
  document.getElementById('id_Price').value()="2988.99"
}
      

Original Question

How can I manipaluate the values on a form when the submit button is clicked? I have tried -

<button type='submit' class='btn btn-default'>Submit</button>
function submit(){
  document.getElementById('id_Price').innerHTML()="2988.99"
  RoomBookingsForm['Price'].value()="2988.99"
  document.getElementById('id_Price').value()="2988.99"
}


<button type='submit' onsubmit='submitForm()' class='btn btn-default'>Submit</button>          
function submitForm(){
  document.getElementById('id_Price').innerHTML()="2988.99"
  RoomBookingsForm['Price'].value()="2988.99"
  document.getElementById('id_Price').value()="2988.99"
}

The purpose of this is to present the dates on the form based on the users language / timezone web browser settings. But ultimately save the date to the backend using the American format.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In order to change the value when user hits submit you can (for example) change the type to button and then submit your data programaticaly via js.

Something like this:

validate = function() {
  // change value when click
  document.getElementById('id_Price').value="2988.99";
  // submit the form progrematically 
  document.getElementById('demo').submit();
}
<form id="demo">
  <input id="id_Price" value="100" />
  <button type='button' onclick="validate()" class='btn btn-default'>Submit</button>
</form>

about 4 years ago · Juan Pablo Isaza Report
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!