Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda