Added a helper method for labels.

This commit is contained in:
Relintai 2021-11-16 14:09:05 +01:00
parent 21bc5c4983
commit b7930fc9de
2 changed files with 29 additions and 4 deletions

View File

@ -2186,6 +2186,26 @@ HTMLTag *HTMLBuilder::input_week() {
return tag.start("input")->itweek(); return tag.start("input")->itweek();
} }
HTMLBuilder *HTMLBuilder::label(const String& pfor, const String& plabel, const String& cls, const String& id) {
HTMLTag *t = label();
t->fora(pfor);
if (cls != "") {
t->cls(cls);
}
if (id != "") {
t->id(id);
}
w(plabel);
clabel();
return this;
}
HTMLTag *HTMLBuilder::input_button(const String &name, const String &value, const String &cls, const String &id) { HTMLTag *HTMLBuilder::input_button(const String &name, const String &value, const String &cls, const String &id) {
HTMLTag *t = input_button(); HTMLTag *t = input_button();

View File

@ -22,10 +22,17 @@ public:
HTMLTag *accept(const String &val); HTMLTag *accept(const String &val);
HTMLTag *src(const String &val); HTMLTag *src(const String &val);
HTMLTag *alt(const String &val); HTMLTag *alt(const String &val);
HTMLTag *autocomplete(const String &val);
HTMLTag *inputmode(const String &val); HTMLTag *inputmode(const String &val);
HTMLTag *list(const String &val); HTMLTag *list(const String &val);
HTMLTag *autocomplete(const String &val);
//autocomplete
//onclick, etc
HTMLTag *checked(const bool val = true); HTMLTag *checked(const bool val = true);
HTMLTag *autofocus(const bool val = true); HTMLTag *autofocus(const bool val = true);
HTMLTag *disabled(const bool val = true); HTMLTag *disabled(const bool val = true);
@ -396,9 +403,7 @@ public:
HTMLTag *input_url(); HTMLTag *input_url();
HTMLTag *input_week(); HTMLTag *input_week();
//label! HTMLBuilder *label(const String& pfor, const String& plabel, const String& cls = "", const String& id = "");
//autocomplete
//onclick, etc
HTMLTag *input_button(const String& name, const String& value = "", const String& cls = "", const String& id = ""); HTMLTag *input_button(const String& name, const String& value = "", const String& cls = "", const String& id = "");
HTMLTag *input_checkbox(const String& name, const String& value = "", const String& cls = "", const String& id = ""); HTMLTag *input_checkbox(const String& name, const String& value = "", const String& cls = "", const String& id = "");