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

136
Views
¿Cómo puedo manipular los valores en un formulario cuando se hace clic en el botón Enviar?

Actualización 2 - Resuelto

Al reflexionar con la Actualización 1, estuve cerca de resolver mi problema, esta es mi solución final.

 <button type='submit' onclick="validate()" class='btn btn-default'>Submit</button> validate = function() { document.getElementById('id_Price').value="2988.99" }

Actualización 1

He tenido un poco más de éxito con esto:

 <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" }

Pregunta inicial

¿Cómo puedo manipular los valores en un formulario cuando se hace clic en el botón Enviar? Yo he tratado -

 <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" }

El propósito de esto es presentar las fechas en el formulario en función de la configuración del navegador web de idioma/zona horaria de los usuarios. Pero, en última instancia, guarde la fecha en el backend utilizando el formato estadounidense.

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

0

Para cambiar el valor cuando el usuario presiona submit , puede (por ejemplo) cambiar el type a button y luego enviar sus datos programáticamente a través de js .

Algo como esto:

 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!