-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_utils.h
More file actions
36 lines (27 loc) · 1.37 KB
/
Copy pathhtml_utils.h
File metadata and controls
36 lines (27 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef HTML_UTILS_H
#define HTML_UTILS_H
#include <Arduino.h>
namespace HtmlUtils {
String escape(const String& s);
// <input type="text"> / "password" / "number"
String inputText(const String& name, const String& label, const String& value, int maxLen = 0);
String inputPassword(const String& name, const String& label, const String& placeholder = "");
String inputNumber(const String& name, const String& label, long value, long minVal, long maxVal);
// Radio group: pairs of (value, label) and a currently-selected value.
struct RadioOption {
const char* value;
const char* label;
};
String radioGroup(const String& name, const RadioOption* options, int count, const String& selectedValue);
// <select> with preset options + an optional "Custom" entry. If currentValue
// matches one of the options, that option is preselected; otherwise the
// Custom entry is preselected and currentValue is placed into the paired
// custom-text input (rendered separately via inputText).
String selectWithCustom(const String& name, const String& label,
const char* const* options, int count,
const String& currentValue,
const String& customOptionValue = "__custom__");
// Single labelled checkbox inside .checkbox-item.
String checkboxItem(const String& name, const String& label, bool checked);
} // namespace HtmlUtils
#endif