Hi all,
i'm stuck with a stubborn problem that i can't seem to get around. I have the board setup that when i have made a wifi connection, the board shows me a html page where i can put in some settings. Those settings are coming from the Preferences.h library and that works, but i can't seem to get the variables in the HTML.
I'm using AsyncWebServer with this a html :
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
<title>Captive Portal Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.field-icon {
float: right;
margin-left: -25px;
margin-top: -25px;
position: relative;
z-index: 2;
}
.h1{
color:orange;
font-weight:700;
}
.container{
padding-top:50px;
margin: auto;
}
.inputfield
{
font-size:20px;
}
button.D{
margin-top:20px;
background-color:#dc3630
font-size:25px;
width:50%;
}
button:active{opacity:50% !important;cursor:wait;transition-delay: 0s}
</style>
</head><body>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h3>Wifi Settings</h3>
<hr>
<div class="panel panel-default">
<div class="panel-body">
<form class="form-horizontal" method="" action="">
<div class="form-group">
<label class="col-md-4 control-label">Wifi SSID</label>
<div class="col-md-6">
<input class="inputfield" type="text" class="form-control" name="SSID" value="%SSID%">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">WiFi Password</label>
<div class="col-md-6">
<input class="inputfield" id="password-field" type="password" class="form-control" name="password" value="secret">
<span toggle="#password-field" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div>
</div>
<div class="col-md-6">
<button class="D" type="submit">Save and reboot</button><br/>\n </div>
</div>
</div>
</div></form>
</div>
</div>
</div>
</body></html>)rawliteral";
and then i have this :
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html, processor);
Serial.println("Client Connected");
});
String processor(const String& var)
{
if(var == "SSID")
return "testSSID";
return String();
}
Whatever i try, i only see the %SSID% in my inputfield and not the 'testSSID'.
Am i missing something here?
thanks allot for any help.