mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added more dropdown helpers.
This commit is contained in:
parent
94381a3e42
commit
fd7bcb43cb
@ -370,6 +370,14 @@ HTMLTag *HTMLTag::checked(const bool val) {
|
||||
return this;
|
||||
}
|
||||
|
||||
HTMLTag *HTMLTag::selected(const bool val) {
|
||||
if (val) {
|
||||
result += " selected";
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
HTMLTag *HTMLTag::autofocus(const bool val) {
|
||||
if (val) {
|
||||
result += " autofocus";
|
||||
@ -1569,6 +1577,37 @@ HTMLBuilder *HTMLBuilder::ftextarea(const String &name, const String &body, cons
|
||||
return this;
|
||||
}
|
||||
|
||||
HTMLTag *HTMLBuilder::select(const String &name, const String &cls, const String &id) {
|
||||
HTMLTag *t = select();
|
||||
|
||||
t->name(name);
|
||||
|
||||
if (cls != "") {
|
||||
t->cls(cls);
|
||||
}
|
||||
|
||||
if (id != "") {
|
||||
t->id(id);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
HTMLTag *HTMLBuilder::option(const String &value) {
|
||||
HTMLTag *t = option();
|
||||
|
||||
t->value(value);
|
||||
|
||||
return t;
|
||||
}
|
||||
HTMLBuilder *HTMLBuilder::foption(const String &value, const String &body, const bool selected) {
|
||||
option(value)->selected(selected);
|
||||
w(body);
|
||||
coption();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
//Closing tags
|
||||
|
||||
HTMLBuilder *HTMLBuilder::ca() {
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
HTMLTag *onclick(const String &val);
|
||||
|
||||
HTMLTag *checked(const bool val = true);
|
||||
HTMLTag *selected(const bool val = true);
|
||||
HTMLTag *autofocus(const bool val = true);
|
||||
HTMLTag *disabled(const bool val = true);
|
||||
HTMLTag *multiple(const bool val = true);
|
||||
@ -313,6 +314,11 @@ public:
|
||||
HTMLTag *textarea(const String& name, const String& cls = "", const String& id = "");
|
||||
HTMLBuilder *ftextarea(const String& name, const String& body, const String& cls = "", const String& id = "");
|
||||
|
||||
HTMLTag *select(const String& name, const String& cls = "", const String& id = "");
|
||||
|
||||
HTMLTag *option(const String& value);
|
||||
HTMLBuilder *foption(const String& value, const String& body, const bool selected = false);
|
||||
|
||||
//closing tags c prefix means close
|
||||
//Note simple tags should not have these like <br>
|
||||
//Note that I might have a few that shouldn't be here, those will be removed as I find them
|
||||
|
Loading…
Reference in New Issue
Block a user