Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda