Form refuses to submit form data em Javascript Postado Outubro 9, 2019 Hi, I am struggling to find why my form fails to submit the data on it. The page code is listed below. Also the web server (an ESP32 web-server) displays all it receives from the browser. The alert dialog box shows OK but data on the form is not submitted. Please check web server printout on page submit Assistance welcome Thanks Paulo <!DOCTYPE html><html lang=pt-BR> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="data:,"> <style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: left;} .button { background-color: #4CAF50; border: none; color: white; padding: 16px 40px; text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;} .button2 {background-color: #555555;} table, th, td { border: 1px solid blue; border-collapse: collapse;} </style> <script language="JavaScript"> function loadParms(){ document.getElementById("wifissid").value ="mySSID"; document.getElementById("wifiPass").value ="myPASS"; document.getElementById("delayPrimFoto").value ="1"; document.getElementById("delayEntreFotos").value ="3"; document.getElementById("fireFlash").value ="1"; document.getElementById("totFotos").value ="5"; document.getElementById("timeGMT").value ="-3"; document.getElementById("sendtoemail").value ="1"; document.getElementById("smtpServer").value ="smtp.gmail.com"; document.getElementById("smtpUser").value ="myacct@gmail.com"; document.getElementById("smtpPass").value ="myEPass"; document.getElementById("emailto").value ="MyDestination@gmail.com"; document.getElementById("emailTitle").value ="Fotos sala, Copacabana, 123"; document.getElementById("emailMessage").value ="Fotos tiradas neste momento:"; document.getElementById("sendtoftp").value ="1"; document.getElementById("ftpServer").value ="ftp.myserver.com"; document.getElementById("ftpUser").value ="ftpUser"; document.getElementById("ftpPass").value ="ftpPass"; } function formToJson(form){ var wifissid = form.wifissid.value; var wifiPass = form.wifiPass.value; var delayPrimFoto = form.delayPrimFoto.value; var delayEntreFotos = form.delayEntreFotos.value; var totFotos = form.totFotos.value; var timeGMT = form.timeGMT.value; var fireFlash = form.fireFlash.value; var sendtoemail = form.sendtoemail.value; var smtpServer = form.smtpServer.value; var smtpUser = form.smtpUser.value; var smtpPass = form.smtpPass.value; var emailto = form.emailto.value; var emailTitle = form.emailTitle.value; var emailMessage = form.emailMessage.value; var sendtoftp = form.sendtoftp.value; var ftpServer = form.ftpServer.value; var ftpUser = form.ftpUser.value; var ftpPass = form.ftpPass.value; var jsonFormInfo = JSON.stringify({ wifissid : wifissid, wifiPass : wifiPass, delayPrimFoto : delayPrimFoto, delayEntreFotos : delayEntreFotos, fireFlash : fireFlash, totFotos : totFotos, timeGMT : timeGMT, sendtoemail : sendtoemail, smtpServer : smtpServer, smtpUser : smtpUser, smtpPass : smtpPass, emailto : emailto, emailTitle : emailTitle, emailMessage : emailMessage, sendtoftp : sendtoftp, ftpServer : ftpServer, ftpUser : ftpUser, ftpPass : ftpPass}); window.alert(jsonFormInfo); } </script> </head> <body onload="loadParms();"><h2><center>Parametrização MyTest</center></h2> <form id="myForm" onSubmit="formToJson(this);"> <table align="center" bgcolor="#cce6ff"> <tr><td colspan=2 align=center><b>Credenciais para Coneção WiFi</b><br></td><tr> <tr><td>SSID</td><td><input type="text" id="wifissid" maxlength="16" value=""></td></tr> <tr><td>Senha</td><td><input type="text" id="wifiPass" maxlength="16" value=""></td></tr> <tr><td colspan=2 align=center><b>Registro de fotos: </b></td></tr> <tr><td>Atrazo para primeira foto</td><td><input type="text" id="delayPrimFoto"></td></tr> <tr><td>Espaço entre fotos</td><td><input type="text" id="delayEntreFotos"></td></tr> <tr><td>Total de Fotos</td><td><input type="text" id="totFotos" maxlength="2"></td></tr> <tr><td><b>Disparar Flash?</b></td><td align=center><select id="fireFlash"><option value=1>Sim</option><option value=0>Não</option></select></td></tr> <tr><td>Fuso horário</td><td align=center><select id="timeGMT"><option value=-3>GMT-3 Brasilia</option><option value=2>GMT+2 S.Africa</option><option value=1>GMT+1 França</option></select></td></tr> <tr><td><b>Enviar Fotos via Email?</b></td><td align=center><select id="sendtoemail"><option value=1>Sim</option><option value=0>Não</option></select></td></tr> <tr><td>URL Servidor de Email</td><td><input type="text" id="smtpServer" maxlength="32"></td></tr> <tr><td>Conta de Email remetente</td><td><input type="text" id="smtpUser" maxlength="64"></td></tr> <tr><td>Senha Email remetente</td><td><input type="text" id="smtpPass" maxlength="32"></td></tr> <tr><td>Email destinatário</td><td><input type="text" id="emailto" maxlength="128"></td></tr> <tr><td>Título do Email</td><td><input type="text" id="emailTitle" maxlength="128"></td></tr> <tr><td>Mensagem no Email</td><td><input type="text" id="emailMessage" maxlength="128"></td></tr> <tr><td><b>Enviar Fotos para servidor FTP?</b></td><td align=center><select id="sendtoftp"><option value=1>Sim</option><option value=0>Não</option></select></td></tr> <tr><td>URL servidor FTP</td><td><input type="text" id="ftpServer"></td></tr> <tr><td>Usuário FTP</td><td><input type="text" id="ftpUser" maxlength="16"></td></tr> <tr><td>Senha FTP</td><td><input type="text" id="ftpPass" maxlength="16"></td></tr> <tr><td colspan=2 align=center><input value="Salvar Configuração" type="submit"></td></tr> </table> </form> </body></html> Web Server monitor displays: Payload is should be the content of the form fields but it comes out empty. It worked in the past but after several updates it stopped working and I cannot figure out why. Thanks New Client. GET / HTTP/1.1 Referer: http://192.168.4.1/ Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: pt-BR Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362 Accept-Encoding: gzip, deflate Host: 192.168.4.1 DNT: 1 Connection: Keep-Alive Payload: Client disconnected.
Form refuses to submit form data
em Javascript
Postado
Hi, I am struggling to find why my form fails to submit the data on it.
The page code is listed below.
Also the web server (an ESP32 web-server) displays all it receives from the browser.
The alert dialog box shows OK but data on the form is not submitted.
Please check web server printout on page submit
Assistance welcome
Thanks
Paulo
Web Server monitor displays:
Payload is should be the content of the form fields but it comes out empty.
It worked in the past but after several updates it stopped working and I cannot figure out why.
Thanks
New Client. GET / HTTP/1.1 Referer: http://192.168.4.1/ Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: pt-BR Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362 Accept-Encoding: gzip, deflate Host: 192.168.4.1 DNT: 1 Connection: Keep-Alive Payload: Client disconnected.