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

116
Visualizações
Los botones de radio JS valoran solo un resultado en el envío

Tengo mi formulario configurado para ejecutar una función y esta función cambiará el href a la página siguiente según la selección de botones de opción. por algún motivo, el valor no se envía y, cuando se envía, solo aparece como VoIP.

evalportalp1.html:

 <!DOCTYPE html> <html lang="en"> <head> </head> <body> <form id="myForm" onsubmit="goPThree(event)" method="get"> <div id="pBFContainer"> <div id="bodyFOption1"> <label for="email">Enter email address for service confirmation:<p></label> <input type='email' id='inputEmail' name='email' minlength="10" size="70" required></input> </div> <div id="bodyFOption2"> <label for="testType">Choose the test theme for your evaluation:<p></label> <input class="optionT" type='radio' name='testType' value='voip' checked>VoIP Readiness<p> <input class="optionT" type='radio' name='testType' value='bandwidth'>Bandwidth quality, user experience, throughput, and capacity.<br><br> </div> </div> <input type="submit" id="subButton" value="Next..." /> </form> </body> <script type="text/javascript" src="evalportalp1.js"></script> </html>

evalportalp1.js:

 var ls = window.location.search; var qs = new URLSearchParams(ls); var testType = qs.get("testType"); function goPThree(event) { event.preventDefault(); switch (testType) { case "voip": console.log("testtype is voip"); window.location.href = "evalportalv3.html" + ls; case "bandwidth": console.log("testtype is bandwidth"); window.location.href = "evalportalb3.html" + ls; default: alert("Please pick a valid Option"); } return false; }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Debe obtener el valor del campo testType cada vez que envíe. De lo contrario, solo estaría leyendo el valor que está actualmente en la URL.

 function goPThree(event) { event.preventDefault(); const formData = new FormData(event.target); const testType = formData.get("testType"); switch (testType) { case "voip": console.log("testtype is voip"); window.location.href = "evalportalv3.html" + ls; case "bandwidth": console.log("testtype is bandwidth"); window.location.href = "evalportalb3.html" + ls; default: alert("Please pick a valid Option"); } return false; }
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