diff --git a/docs/acelements.html b/docs/acelements.html
index cb81c92..14e7a74 100644
--- a/docs/acelements.html
+++ b/docs/acelements.html
@@ -732,6 +732,13 @@
label
+
+
+
AutoConnectSelect( const char * name, std :: vector < String > const & options, const char * label)
+AutoConnectSelect( const char * name, std :: vector < String > const & options, const char * label, const uint8_t selected)
name
@@ -1868,6 +1882,8 @@ Only will be displayed if a label is not specified
An options
is an array of String type for the options which as actually std::vector for an HTML < option >
tag. It is an initialization list can be used. The option tags will be generated from each entry in the options, the amount of which is the same as the number of items in an options
.
label
A label
is an optional string. A label is always arranged on the left side of the drop-down list. Specification of a label will generate an HTML < label >
tag with an id attribute. The select tag and the label are connected by the id attribute.
+ selected
+A selected
is an optional value. Specifies that an option should be pre-selected when the page loads.
AutoConnectSubmit
AutoConnectSubmit generates an HTML < input type = "button" >
tag attached onclick
attribute. The native code of the onclick
attribute is the submission of the form with the POST method.
Sample
diff --git a/docs/apielements.html b/docs/apielements.html
index 74134a6..80f2128 100644
--- a/docs/apielements.html
+++ b/docs/apielements.html
@@ -1076,6 +1076,13 @@
label
+
+
+
+
+ selected
+
+
@@ -1117,6 +1124,13 @@
operator [ ]
+
+
+
+
+ select
+
+
@@ -1124,6 +1138,13 @@
size
+
+
+
+
+ value
+
+
@@ -1167,7 +1188,7 @@
-
+
value
@@ -1241,7 +1262,7 @@
-
+
value
@@ -2096,6 +2117,13 @@
label
+
+
+
+
+ selected
+
+
@@ -2137,6 +2165,13 @@
operator [ ]
+
+
+
+
+ select
+
+
@@ -2144,6 +2179,13 @@
size
+
+
+
+
+ value
+
+
@@ -2187,7 +2229,7 @@
-
+
value
@@ -2261,7 +2303,7 @@
-
+
value
@@ -2586,7 +2628,7 @@ Evaluate the pattern as a regexp and return whether value matches. Always return
Parameters
name The element name.
- values An array of values of the radio buttons. Specifies an std::vector object.
+ values An array of values of the radio buttons. Specifies a std::vector object.
label Label string.
order The direction to arrange the radio buttons.
checked An index to be checked in the radio buttons.
@@ -2688,13 +2730,14 @@ Returns current checked option of the radio buttons.
AutoConnectSelect
Constructor
-
AutoConnectSelect( const char * name = "" , std :: vector < String > const & options = {}, const char * label = "" )
+
AutoConnectSelect( const char * name = "" , std :: vector < String > const & options = {}, const char * label = "" , const uint8_t selected = 0 )
Parameters
name The element name.
- options An array of options of the select element. Specifies an std::vector object.
+ options An array of options of the select element. Specifies a std::vector object.
label Label string.
+ selected An option should be pre-selected when the page loads.
Public member variables
name
@@ -2715,6 +2758,12 @@ Returns current checked option of the radio buttons.
Type
String
+
selected
+
A selected
is an optional value. Specifies 1-based index value of an options array that an option should be pre-selected when the page loads.
+
+ Type
+ uint8_t
+
Public member functions
typeOf
ACElement_t typeOf( void )
@@ -2749,7 +2798,14 @@ Returns an option string of the index specified by n .
n Index of options array to return. Its base number is 0.
Return value
A reference of a option string indexed by the specified the n .
-
+
+ select
+
void select ( const String & value);
+
+Selects an option with the value.
+
+ Parameter
+ value String value that option should be selected in an option array.
size
size_t size( void )
@@ -2759,6 +2815,14 @@ Returns number of options which contained.
Return value
Number of options which contained.
+
value
+
const String & value( void ) const ;
+
+Returns current selected option of the select list.
+
+ Return value
+ A String of an option current selected. If there is no select option, a null string returned.
+
AutoConnectSubmit
Constructor
AutoConnectSubmit( const char * name = "" , const char * value = "" , char * uri = "" )
@@ -2776,7 +2840,7 @@ Returns number of options which contained.
Type
String
-
value
+
value
The name of the submit button. It will also be the label of the button.
Type
@@ -2815,7 +2879,7 @@ Returns type of AutoConnectElement.
Type
String
-
value
+
value
A content string of the text element.
Type
diff --git a/examples/Simple/Simple.ino b/examples/Simple/Simple.ino
index ecbe93e..1b5e130 100644
--- a/examples/Simple/Simple.ino
+++ b/examples/Simple/Simple.ino
@@ -33,7 +33,8 @@ static const char AUX_TIMEZONE[] PROGMEM = R"(
"name": "timezone",
"type": "ACSelect",
"label": "Select TZ name",
- "option": []
+ "option": [],
+ "selected": 10
},
{
"name": "newline",
diff --git a/mkdocs/acelements.md b/mkdocs/acelements.md
index 93cf5b8..4371067 100644
--- a/mkdocs/acelements.md
+++ b/mkdocs/acelements.md
@@ -299,7 +299,7 @@ AutoConnectSelect generates an HTML `#!html ` tag (drop-down list) and f
### Constructor
```cpp
-AutoConnectSelect(const char* name, std::vector const& options, const char* label)
+AutoConnectSelect(const char* name, std::vector const& options, const char* label, const uint8_t selected)
```
### name
@@ -314,6 +314,10 @@ An `options` is an array of String type for the options which as actually [std::
A `label` is an optional string. A label is always arranged on the left side of the drop-down list. Specification of a label will generate an HTML `#!html ` tag with an id attribute. The select tag and the label are connected by the id attribute.
+### selected
+
+A `selected` is an optional value. Specifies that an option should be pre-selected when the page loads.
+
## AutoConnectSubmit
AutoConnectSubmit generates an HTML `#!html ` tag attached `#!html onclick` attribute. The native code of the `#!html onclick` attribute is the submission of the form with the **POST** method.
diff --git a/mkdocs/apielements.md b/mkdocs/apielements.md
index 004d360..235ec67 100644
--- a/mkdocs/apielements.md
+++ b/mkdocs/apielements.md
@@ -349,7 +349,7 @@ AutoConnectRadio(const char* name = "", std::vector const& values = {},
**Parameters**
name The element name.
- values An array of values of the radio buttons. Specifies an [std::vector](https://en.cppreference.com/w/cpp/container/vector) object.
+ values An array of values of the radio buttons. Specifies a [std::vector](https://en.cppreference.com/w/cpp/container/vector) object.
label Label string.
order The direction to arrange the radio buttons.
checked An index to be checked in the radio buttons.
@@ -487,13 +487,14 @@ Returns current checked option of the radio buttons.
### Constructor
```cpp
-AutoConnectSelect(const char* name = "", std::vector const& options = {}, const char* label = "")
+AutoConnectSelect(const char* name = "", std::vector const& options = {}, const char* label = "", const uint8_t selected = 0)
```
**Parameters**
name The element name.
- options An array of options of the select element. Specifies an [std::vector](https://en.cppreference.com/w/cpp/container/vector) object.
+ options An array of options of the select element. Specifies a [std::vector](https://en.cppreference.com/w/cpp/container/vector) object.
label Label string.
+ selected An option should be pre-selected when the page loads.
### Public member variables
@@ -522,6 +523,14 @@ A label is an optional string. A label will be arranged in the top of the select
String
+#### selected
+
+A `selected` is an optional value. Specifies 1-based index value of an options array that an option should be pre-selected when the page loads.
+
+ **Type**
+ uint8_t
+
+
### Public member functions
#### typeOf
@@ -568,7 +577,17 @@ Returns an option string of the index specified by **_n_**.
n Index of options array to return. Its base number is 0.
**Return value**
A reference of a option string indexed by the specified the **n**.
-
+
+
+####
select
+
+```cpp
+void select(const String& value);
+```
+Selects an option with the value.
+
+ **Parameter**
+ value String value that option should be selected in an option array.
####
size
@@ -582,6 +601,17 @@ Returns number of options which contained.
Number of options which contained.
+####
value
+
+```cpp
+const String& value(void) const;
+```
+Returns current selected option of the select list.
+
+ **Return value**
+ A String of an option current selected. If there is no select option, a null string returned.
+
+
## AutoConnectSubmit
###
Constructor