Supports the enable attribute for all AutoConnectElements

pull/69/head^2
Hieromon Ikasamo 5 years ago
parent 5dab5f65de
commit 27c4a0a1be
  1. 1
      README.md
  2. 54
      src/AutoConnectElementBasisImpl.h

@ -103,6 +103,7 @@ Full documentation is available on https://Hieromon.github.io/AutoConnect, some
- Supports **AutoConnectElement::as<T\>** function to easily coding for conversion from an AutoConnectElement to an actual type.
- Supports new element type **AutoConnectFile** and built-in file uploader.
- Supports a **format attribute** with the AutoConnectText element.
- Supports a **AutoConnectSelect::selected** attribute.
- Fixed blank page responds with Configure new.
- Changed menu labels placement in source files structure.

@ -181,21 +181,23 @@ void AutoConnectRadioBasis::empty(const size_t reserve) {
const String AutoConnectRadioBasis::toHTML(void) const {
String html = String("");
if (label.length()) {
html = label;
if (order == AC_Vertical)
html += String(F("<br>"));
}
uint8_t n = 0;
for (const String value : _values) {
n++;
String id = name + "_" + String(n);
html += String(F("<input type=\"radio\" name=\"")) + name + String(F("\" id=\"")) + id + String(F("\" value=\"")) + value + String("\"");
if (n == checked)
html += String(F(" checked"));
html += String(F("><label for=\"")) + id + String("\">") + value + String(F("</label>"));
if (order == AC_Vertical)
html += String(F("<br>"));
if (enable) {
if (label.length()) {
html = label;
if (order == AC_Vertical)
html += String(F("<br>"));
}
uint8_t n = 0;
for (const String value : _values) {
n++;
String id = name + "_" + String(n);
html += String(F("<input type=\"radio\" name=\"")) + name + String(F("\" id=\"")) + id + String(F("\" value=\"")) + value + String("\"");
if (n == checked)
html += String(F(" checked"));
html += String(F("><label for=\"")) + id + String("\">") + value + String(F("</label>"));
if (order == AC_Vertical)
html += String(F("<br>"));
}
}
return html;
}
@ -245,17 +247,19 @@ void AutoConnectSelectBasis::select(const String& value) {
const String AutoConnectSelectBasis::toHTML(void) const {
String html = String("");
if (label.length())
html = String(F("<label for=\"")) + name + String("\">") + label + String(F("</label>"));
html += String(F("<select name=\"")) + name + String(F("\" id=\"")) + name + String("\">");
uint8_t n = 1;
for (const String option : _options) {
html += String(F("<option value=\"")) + option + "\"";
if (n++ == selected)
html += String(F(" selected"));
html += ">" + option + String(F("</option>"));
if (enable) {
if (label.length())
html = String(F("<label for=\"")) + name + String("\">") + label + String(F("</label>"));
html += String(F("<select name=\"")) + name + String(F("\" id=\"")) + name + String("\">");
uint8_t n = 1;
for (const String option : _options) {
html += String(F("<option value=\"")) + option + "\"";
if (n++ == selected)
html += String(F(" selected"));
html += ">" + option + String(F("</option>"));
}
html += String(F("</select>"));
}
html += String(F("</select>"));
return html;
}

Loading…
Cancel
Save