Hi, I really need your support and I hope you can find a minute to help me calling a user function from this HTML code (the OTA WebUpdater example), replacing the "window.open('/serverIndex')" line statement:
const char* loginIndex =
"<form name='loginForm'>"
"<table width='20%' bgcolor='A09F9F' align='center'>"
"<tr>"
"<td colspan=2>"
"<center><font size=4><b>ESP32 Login Page</b></font></center>"
"
"
"</td>"
"
"
"
"
"</tr>"
"<td>Username:</td>"
"<td><input type='text' size=25 name='userid'>
</td>"
"</tr>"
"
"
"
"
"<tr>"
"<td>Password:</td>"
"<td><input type='Password' size=25 name='pwd'>
</td>"
"
"
"
"
"</tr>"
"<tr>"
"<td><input type='submit' onclick='check(this.form)' value='Login'></td>"
"</tr>"
"</table>"
"</form>"
"<script>"
"function check(form)"
"{"
"if(form.userid.value=='admin' && form.pwd.value=='admin')"
"{"
"window.open('/serverIndex')"
"}"
"else"
"{"
" alert('Error Password or Username')/*displays error message*/"
"}"
"}"
"</script>";
The function I need to call is taken from the G6EJD's Tech Note 087 code and is called HomePage():
void HomePage() {
SendHTML_Header();
webpage += F("<a href='/download'><button>Descargar</button></a>");
webpage += F("<a href='/upload'><button>Cargar</button></a>");
webpage += F("<a href='/stream'><button>Stream</button></a>");
webpage += F("<a href='/delete'><button>Borrar</button></a>");
webpage += F("<a href='/dir'><button>Directorio</button></a>");
append_page_footer();
SendHTML_Content();
SendHTML_Stop();
}
I am very inexperienced and I have not gotten it to work.
Oslaf