diff --git a/WiFiManager.cpp b/WiFiManager.cpp index f202ce0..818d614 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -33,20 +33,20 @@ WiFiManagerParameter::WiFiManagerParameter(const char *custom) { _label = NULL; _length = 1; _value = NULL; - _labelPlacement = WFM_LABEL_BEFORE; + _labelPlacement = WFM_LABEL_DEFAULT; _customHTML = custom; } WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label) { - init(id, label, "", 0, "", WFM_LABEL_BEFORE); + init(id, label, "", 0, "", WFM_LABEL_DEFAULT); } WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length) { - init(id, label, defaultValue, length, "", WFM_LABEL_BEFORE); + init(id, label, defaultValue, length, "", WFM_LABEL_DEFAULT); } WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom) { - init(id, label, defaultValue, length, custom, WFM_LABEL_BEFORE); + init(id, label, defaultValue, length, custom, WFM_LABEL_DEFAULT); } WiFiManagerParameter::WiFiManagerParameter(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement) { diff --git a/WiFiManager.h b/WiFiManager.h index ee69878..1588bad 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -129,6 +129,7 @@ #define WFM_LABEL_BEFORE 1 #define WFM_LABEL_AFTER 2 #define WFM_NO_LABEL 0 +#define WFM_LABEL_DEFAULT 1 class WiFiManagerParameter { public: diff --git a/examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino index f1fbf1a..b92d34f 100644 --- a/examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/Super/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -29,7 +29,7 @@ int TESP_CP_TIMEOUT = 90; // test cp timeout bool TEST_NET = true; // do a network test after connect, (gets ntp time) bool ALLOWONDEMAND = true; // enable on demand int ONDDEMANDPIN = 0; // gpio for button -bool WMISBLOCKING = false; // use blocking or non blocking mode +bool WMISBLOCKING = true; // use blocking or non blocking mode, non global params wont work in non blocking // char ssid[] = "*************"; // your network SSID (name) // char pass[] = "********"; // your network password @@ -90,7 +90,7 @@ void setup() { // wm.erase(); // setup some parameters - WiFiManagerParameter custom_html("

This Is Custom HTML

"); // only custom html + WiFiManagerParameter custom_html("

This Is Custom HTML

"); // only custom html WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "", 40); WiFiManagerParameter custom_mqtt_port("port", "mqtt port", "", 6); WiFiManagerParameter custom_token("api_token", "api token", "", 16); @@ -98,7 +98,29 @@ void setup() { WiFiManagerParameter custom_ipaddress("input_ip", "input IP", "", 15,"pattern='\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}'"); // custom input attrs (ip mask) const char _customHtml_checkbox[] = "type=\"checkbox\""; - WiFiManagerParameter custom_checkbox("checkbox", "my checkbox", "T", 2, _customHtml_checkbox, WFM_LABEL_AFTER); + WiFiManagerParameter custom_checkbox("my_checkbox", "My Checkbox", "T", 2, _customHtml_checkbox,WFM_LABEL_AFTER); + + const char *bufferStr = R"( + +
+

Select Choice

+ +
+ +
+ + +
+ + + )"; + + WiFiManagerParameter custom_html_inputs(bufferStr); // callbacks wm.setAPCallback(configModeCallback); @@ -115,6 +137,8 @@ void setup() { wm.addParameter(&custom_ipaddress); wm.addParameter(&custom_checkbox); + wm.addParameter(&custom_html_inputs); + // set values later if you want custom_html.setValue("test",4); custom_token.setValue("test",4); diff --git a/extras/WiFiManager.template.html b/extras/WiFiManager.template.html index 45700a4..ace9f7c 100644 --- a/extras/WiFiManager.template.html +++ b/extras/WiFiManager.template.html @@ -43,18 +43,22 @@ body { max-width:500px; } div, -input { +input,select { padding: 5px; font-size: 1em; /*width: 100%;*/ - margin:5px 0; + /*/*margin: 3px 0 10px 0; // BEFORE spacing shows label closer to input, but need to do same for AFTER*/ + margin: 5px 0; box-sizing: border-box; } -input,button,.msg{ +div{ + margin: 5px 0; +} +input,button,select,.msg{ border-radius:.3rem; width: 100%; } -input[type=radio]{ +input[type=radio],input[type=checkbox]{ width: auto; } button,input[type="button"],input[type="submit"] { @@ -321,20 +325,43 @@ input:disabled {
-
* Upload may not function inside captive portal, Open in browser - http://192.168.4.1



-
-
-
+
+ +
+ +
+ + + + + +
+ + +

Select Choice

+

+ +
+ + + + + diff --git a/strings_en.h b/strings_en.h index 3c9b891..9fc6f23 100644 --- a/strings_en.h +++ b/strings_en.h @@ -60,7 +60,7 @@ const char HTTP_FORM_STATIC_HEAD[] PROGMEM = "

"; const char HTTP_FORM_END[] PROGMEM = "

"; const char HTTP_FORM_LABEL[] PROGMEM = ""; const char HTTP_FORM_PARAM_HEAD[] PROGMEM = "

"; -const char HTTP_FORM_PARAM[] PROGMEM = "
"; +const char HTTP_FORM_PARAM[] PROGMEM = "
\n"; // do not remove newline! const char HTTP_SCAN_LINK[] PROGMEM = "
"; const char HTTP_SAVED[] PROGMEM = "
Saving Credentials
Trying to connect ESP to network.
If it fails reconnect to AP to try again
"; @@ -79,8 +79,8 @@ const char HTTP_STATUS_NONE[] PROGMEM = "
No AP set
"; const char HTTP_BR[] PROGMEM = "
"; const char HTTP_STYLE[] PROGMEM = "