Keep form fields updated.
This commit is contained in:
parent
a996c13e63
commit
afe5b9338d
|
@ -83,27 +83,26 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||||
HH + ':' + II + ':' + SS;
|
HH + ':' + II + ':' + SS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit timestamps as unix seconds
|
// Submit timestamps as unix seconds when form is submitted
|
||||||
var putDate = function(form) {
|
var putDate = function(form) {
|
||||||
form.inputTimeUnix.value = Math.floor(Date.now() / 1000);// - new Date().getTimezoneOffset()*60;
|
form.inputTimeUnix.value = Math.floor(Date.now() / 1000);// - new Date().getTimezoneOffset()*60;
|
||||||
form.inputStartTimeUnix.value = ((Date.parse(js_start_time_unix_entry.value))/1000);
|
form.inputStartTimeUnix.value = ((Date.parse(js_start_time_unix_entry.value))/1000);
|
||||||
//document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/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
|
// Fill in page values
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
//document.getElementById("hidden-form").onload = function() {
|
|
||||||
//top.location.reload();
|
|
||||||
//}
|
|
||||||
// Current start date to string
|
|
||||||
s = %inputStartTimeUnix%;
|
s = %inputStartTimeUnix%;
|
||||||
current_start = new Date(s * 1000);
|
current_start = new Date(s * 1000);
|
||||||
document.getElementById('current-start').innerHTML = current_start.toLocaleString();
|
document.getElementById('current-start').innerHTML = current_start.toLocaleString();
|
||||||
// Show the local time as a string
|
// Show the local time as a string
|
||||||
local_time_unix = new Date().toLocaleString();//toUTCString();
|
local_time_unix = new Date().toLocaleString();//toUTCString();
|
||||||
document.getElementById('local-time-unix').innerHTML = local_time_unix.toString();
|
document.getElementById('local-time-unix').innerHTML = local_time_unix.toString();
|
||||||
// fill in the start time field as local time
|
// Fill in the start time field as local time
|
||||||
//document.getElementById('js_start_time_unix_entry').value = current_start.toISOString().slice(0,16);
|
|
||||||
document.getElementById('js_start_time_unix_entry').value = current_start.toDatetimeLocal();
|
document.getElementById('js_start_time_unix_entry').value = current_start.toDatetimeLocal();
|
||||||
|
|
||||||
|
// Fill in the other form fields
|
||||||
|
document.getElementById("send-program").value = %inputSend%;
|
||||||
|
document.getElementById("message").value = %inputMsg%;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script></head><body>
|
</script></head><body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user