Group inputs into one webform #5

Merged
mattbk merged 2 commits from share-webform into main 2023-08-31 11:20:39 -05:00
Showing only changes of commit 9b928cb11b - Show all commits

View File

@ -49,15 +49,19 @@ const char index_html[] PROGMEM = R"rawliteral(
}
</script></head><body>
<form action="/get" target="hidden-form">
inputString (current value %inputString%): <input type="text" name="inputString" value=%inputString%>
inputString (current value %inputString%): <input type="text" name="inputString" value=%inputString%><br>
<!--
<input type="submit" value="Submit" onclick="submitMessage()">
</form><br>
<form action="/get" target="hidden-form">
Seconds between flash (current value %inputInt%): <input type="number " name="inputInt" value = %inputInt%>
-->
Seconds between flash (current value %inputInt%): <input type="number " name="inputInt" value = %inputInt%><br>
<!--
<input type="submit" value="Submit" onclick="submitMessage()">
</form><br>
<form action="/get" target="hidden-form">
inputFloat (current value %inputFloat%): <input type="number " name="inputFloat" value = %inputFloat%>
-->
inputFloat (current value %inputFloat%): <input type="number " name="inputFloat" value = %inputFloat%><br>
<input type="submit" value="Submit" onclick="submitMessage()">
</form>
<iframe style="display:none" name="hidden-form"></iframe>
@ -304,18 +308,18 @@ void setup() {
writeFile(SPIFFS, "/inputString.txt", inputMessage.c_str());
}
// GET inputInt value on <ESP_IP>/get?inputInt=<inputMessage>
else if (request->hasParam(PARAM_INT)) {
if (request->hasParam(PARAM_INT)) {
inputMessage = request->getParam(PARAM_INT)->value();
writeFile(SPIFFS, "/inputInt.txt", inputMessage.c_str());
}
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
else if (request->hasParam(PARAM_FLOAT)) {
if (request->hasParam(PARAM_FLOAT)) {
inputMessage = request->getParam(PARAM_FLOAT)->value();
writeFile(SPIFFS, "/inputFloat.txt", inputMessage.c_str());
}
else {
inputMessage = "No message sent";
}
// else {
// inputMessage = "No message sent";
// }
Serial.println(inputMessage);
request->send(200, "text/plain", inputMessage);
@ -353,14 +357,14 @@ void loop() {
// float yourInputFloat = readFile(SPIFFS, "/inputFloat.txt").toFloat();
// if you want to send code, and it's not sending, then start it up
if(yourInputInt != 0 & morseLed.IsRunning() == false){
if((yourInputInt != 0) & (morseLed.IsRunning() == false)){
//jled
morseLed.Reset().Update();
//morse.send("CQ CQ CQ DE W1CDN K"); //etherkit morse
//telegraph26.send("CQ CQ CQ DE W1CDN K"); //telegraph
// if you want to send code, and it is sending, keep sending
} else if(yourInputInt != 0 & morseLed.IsRunning() == true){
} else if((yourInputInt != 0) & (morseLed.IsRunning() == true)){
morseLed.Update();
// if you don't want to send code
} else {