Refresh webform automatically after submit so values are right.
This commit is contained in:
parent
c65bc22028
commit
2060df9691
|
@ -61,10 +61,18 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||
<!DOCTYPE HTML><html><head>
|
||||
<title>ESP Input Form</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script>
|
||||
<script type='text/javascript'>
|
||||
// Submit timestamps as unix seconds
|
||||
var putDate = function(form) {
|
||||
form.inputTimeUnix.value = Math.floor(Date.now() / 1000);
|
||||
document.getElementById("js_start_time_unix").value = (Date.parse(js_start_time_unix_entry.value))/1000;
|
||||
};
|
||||
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
|
||||
window.onload = function() {
|
||||
document.getElementById("hidden-form").onload = function() {
|
||||
top.location.reload();
|
||||
}
|
||||
}
|
||||
</script></head><body>
|
||||
<form action="/get" target="hidden-form" onsubmit="putDate(this);">
|
||||
|
||||
|
@ -99,10 +107,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||
|
||||
<input type="submit" value="Submit"">
|
||||
</form>
|
||||
<iframe style="display:none" name="hidden-form"></iframe>
|
||||
<script>
|
||||
document.getElementById("js_start_time_unix").value = (Date.parse(js_start_time_unix_entry.value))/1000;
|
||||
</script>
|
||||
<iframe style="display:none" name="hidden-form" id="hidden-form"></iframe>
|
||||
</body></html>)rawliteral";
|
||||
|
||||
// Auxiliary variables to store the current output state
|
||||
|
|
Loading…
Reference in New Issue
Block a user