AutoConnectElements API
Only for AutoConnect
The following AutoConnectElements are valid only for AutoConnect; they are not available for AutoConnectCore.
AutoConnectButton¶
Constructor¶
AutoConnectButton(const char* name = "", const char* value = "", const String& action = String(), const ACPosterior_t post = AC_Tag_None)
- Parameters
- nameThe element name.
- valueValue of the element.
- actionNative code of the action script executed when the button is clicked.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
action¶
HTML native code of the action script to be executed when the button is clicked. It is mostly used with a JavaScript to activate a script.1
- Type
- String
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
value¶
Value of the element.
- Type
- String
Public member functions¶
canHandle¶
bool canHandle(void)
Returns whether the AutoConnectButton element has a registered event handler and can respond to a click event.
- Return value
- trueAn event handler is registered. The element can correspond to a click event.
- falseAn event handler is not registered.
off¶
void off(void)
Release a registered event handler so that the element does not react to events.
on¶
void on(std::function<void(AutoConnectButton&, AutoConnectAux&)> eventHandler)
Register an event handler function so that the element can respond to a click event.
- Parameter
- eventHandlerA function instance corresponding to a click event on AutoConnectButton. It allows giving with lambda expressions.
An eventHandler function will be called when a click event occurs with the AutoConnectButton. Its prototype declaration is follows:
void eventHandler(AutoConnectButton& me, AutoConnectAux& aux)
- Parameter
- meA reference to the instance of the AutoConnectButton that fired the click event.
- auxReference to the AutoConnectAux instance to which the AutoConnectButton that generated the click event belongs.
response¶
void response(const char* value)
void response(const char* attribute, const char* value)
Reply the value or attribute of an element to the client. The response
is usually used for sending a reply to the client with the element's value or attribute that has been updated in an event handler function.
The response
function itself does not perform communication. It only temporarily accumulates updated values. The stored content constitutes the response data to the HTTP POST request sent from the client browser caused by the AutoConnectElements event.
The response
function has two overloads with different numbers of arguments. A response
function suitable for just one argument will only update the value of the AutoConnectButton. It also stores the updated value of the button caption text (i.e., the innerHTML
attribute dependent on the button type="button"
element) into the response data for real-time rendering in the browser upon response. Also, a response
function suitable for two arguments allows updating all attributes of the HTML button type="button"
element derived from AutoConnectButton.
- Parameter
- valueSuitable for one argument format: A changing value of AutoConnectButton::value as response. It also will update the
innerHTML
attribute of thebutton type="button"
element derived from AutoConnectButton.
Suitable for two argument format: Specifies a value of the HTMLbutton type="button"
element to be modified as specified in theattribute
argument. - attributeAn attribute name of an HTML
button type="button"
element to be changed.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectButton.
- Return value
- AC_Button
AutoConnectCheckbox¶
Constructor¶
AutoConnectCheckbox(const char* name = "", const char* value = "", const char* label = "", const bool checked = false, const ACPosition_t labelPosition = AC_Behind, const ACPosterior_t post = AC_Tag_BR)
- Parameters
- nameThe element name.
- valueValue of the element.
- labelA label string prefixed to the checkbox.
- checkChecked state of the checkbox.
- labelPositionSpecifies the position of the label to generate.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
checked¶
It indicates the checked status of the checkbox. The value of the checked checkbox element is packed in the query string and sent by submit.
- Type
- bool
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
label¶
A label is an optional string. A label is always arranged on the right side of the checkbox. Specification of a label will generate an HTML <label>
tag with an id
attribute. The checkbox and the label are connected by the id attribute.
- Type
- String
labelPosition¶
Specifies the position of the label to generate with ACPostion_t enumeration value.
- Type
- ACPosition_t
AC_Infront
: Place a label in front of the check box.AC_Behind
: Place a label behind the check box.
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
value¶
Value of the element. It becomes a value attribute of an HTML <input type="checkbox">
tag.
- Type
- String
Public member functions¶
canHandle¶
bool canHandle(void)
Returns whether the AutoConnectCheckbox element has a registered event handler and can respond to a change event.
- Return value
- trueAn event handler is registered. The element can correspond to a change event.
- falseAn event handler is not registered.
off¶
void off(void)
Release a registered event handler so that the element does not react to events.
on¶
void on(std::function<void(AutoConnectCheckbox&, AutoConnectAux&)> eventHandler)
Register an event handler function so that the element can respond to a change event.
- Parameter
- eventHandlerA function instance corresponding to a change event on AutoConnectCheckbox. It allows giving with lambda expressions.
An eventHandler function will be called when a change event occurs with the AutoConnectCheckbox. Its prototype declaration is follows:
void eventHandler(AutoConnectCheckbox& me, AutoConnectAux& aux)
- Parameter
- meA reference to the instance of the AutoConnectCheckbox that fired the change event.
- auxReference to the AutoConnectAux instance to which the AutoConnectCheckbox that generated the change event belongs.
response¶
void response(const bool checked)
void response(const char* attribute, const char* value)
Reply the value or attribute of an element to the client. The response
is usually used for sending a reply to the client with the element's value or attribute that has been updated in an event handler function.
The response
function itself does not perform communication. It only temporarily accumulates updated values. The stored content constitutes the response data to the HTTP POST request sent from the client browser caused by the AutoConnectElements event.
The response
function has two overloads with different numbers of arguments. A response
function suitable for just one argument will only update the check status of the AutoConnectCheckbox. Also, a response
function suitable for two arguments allows updating all attributes of the HTML input type="checkbox"
element derived from AutoConnectCheckbox.
- Parameter
- checkedA changing checked status of AutoConnectCheckbox::checked as response.
- valueSpecifies a value of the HTML
input type="checkbox"
element to be modified as specified in theattribute
argument. - attributeAn attribute name of an HTML
input type="checkbox"
element to be changed.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectCheckbox.
- Return value
- AC_Checkbox
AutoConnectElement¶
Constructor¶
AutoConnectElement(const char* name = "", const char* value = "", const ACPosterior_t post = AC_Tag_None)
- Parameters
- nameThe element name.
- valueValue of the element.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
value¶
Value of the element. It is output as HTML as it is as a source for generating HTML code.
- Type
- String
Public member functions¶
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectElement.
- Return value
- AC_Element
as<T>¶
AutoConnectElement& as<T>(void)
Casts the reference to the AutoConnectElement the specified type.
- Parameter
- TThe element type. AutoConnectElements type such as AutoConnectButton, AutoConnectCheckbox, AutoConnectFile, AutoConnectInput, AutoConnectRadio, AutoConnectSelect, AutoConnectStyle, AutoConnectSubmit, AutoConnectText.
- Return value
- A reference to the AutoConnectElement with actual type.
AutoConnectFile¶
Constructor¶
AutoConnectFile(const char* name = "", const char* value = "", const char* label = "", const ACFile_t store = AC_File_FS, const ACPosterior_t post = AC_Tag_BR)
- Parameters
- nameThe element name.
- valueFile name to be upload.
- labelLabel string.
- storeThe ACFile_t enumerator that represents the media to save the uploaded file.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
label¶
A label is an optional string. A label is always arranged on the left side of the file input box. Specification of a label will generate an HTML <label>
tag with an id attribute. The file input box and the label are connected by the id attribute.
- Type
- String
mimeType¶
The mime type of the upload file which included as Media type in the http post request. Set by the client (usually the browser) that requested the upload. It is determined by the file type as application/octet-stream
, text
etc. which is described in IANA Media Type.
- Type
- String
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
size¶
Size of the uploading file.
- Type
- size_t
store¶
Specifies the save destination of the uploaded file. You can use the built-in uploader to save uploaded file to the flash of the ESP8266/ESP32 module or external SD media without writing a dedicated sketch code. It also supports saving to any destination using a custom uploader that inherits from the AutoConnectUploadHandler class.
- Type
- ACFile_t
AC_File_FS
: Save the uploaded file to SPIFFS in the flash.AC_File_SD
: Save the uploaded file to SD.AC_File_Extern
: Save the file using your own upload handler.
value¶
File name to be upload. The value contains the value entered by the client browser to the <input type="file">
tag and is read-only.
- Type
- String
Public member functions¶
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectFile.
- Return value
- AC_File
AutoConnectInput¶
Constructor¶
AutoConnectInput(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "", const ACPosterior_t post = AC_Tag_BR, const ACInput_t apply = AC_Input_Text)
- Parameters
- nameThe element name.
- valueValue of the element.
- labelLabel string.
- patternRegular expression string for checking data format.
- placeholderA placeholder string.
- postSpecifies the tag to be output afterward the element.
- applySpecifies the type of input that the text box accepts.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
label¶
A label is an optional string. A label is always arranged on the left side of the input box. Specification of a label will generate an HTML <label>
tag with an id attribute. The input box and the label are connected by the id attribute.
- Type
- String
name¶
The element name.
- Type
- String
pattern¶
A pattern specifies a regular expression that the input-box's value is checked against on form submission.
- Type
- String
placeholder¶
A placeholder is an option string. Specification of a placeholder will generate a placeholder
attribute for the input tag.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
value¶
Value of the element. It becomes a value attribute of an HTML <input type="text">
tag. An entered text in the custom Web page will be sent with a query string of the form. The value set before accessing the page is displayed as the initial value.
- Type
- String
apply¶
Specifies the type of input that the text box accepts. AutoConnectInput will generate either a <input type="text">
, <input type="password">
, or <input type="number">
tag based on the apply
specifying as input type. The input type can be specified the following values in the ACInput_t enumeration type. 1
- Type
- ACInput_t
AC_Input_Text
:input type="text"
AC_Input_Password
:input type="password"
AC_Input_Number
:input type="number"
Public member functions¶
canHandle¶
bool canHandle(void)
Returns whether the AutoConnectInput element has a registered event handler and can respond to a change event.
- Return value
- trueAn event handler is registered. The element can correspond to a change event.
- falseAn event handler is not registered.
isValid¶
bool isValid(void)
Evaluate the pattern as a regexp and return whether value matches. Always return true if the pattern is undefined.
- Return value
- trueThe value matches a pattern.
- falseThe value does not match a pattern.
off¶
void off(void)
Release a registered event handler so that the element does not react to events.
on¶
void on(std::function<void(AutoConnectInput&, AutoConnectAux&)> eventHandler)
Register an event handler function so that the element can respond to a change event.
- Parameter
- eventHandlerA function instance corresponding to a change event on AutoConnectInput. It allows giving with lambda expressions.
An eventHandler function will be called when a change event occurs with the AutoConnectInput. Its prototype declaration is follows:
void eventHandler(AutoConnectInput& me, AutoConnectAux& aux)
- Parameter
- meA reference to the instance of the AutoConnectInput that fired the change event.
- auxReference to the AutoConnectAux instance to which the AutoConnectInput that generated the change event belongs.
response¶
void response(const char* value)
void response(const char* attribute, const char* value)
Reply the value or attribute of an element to the client. The response
is usually used for sending a reply to the client with the element's value or attribute that has been updated in an event handler function.
The response
function itself does not perform communication. It only temporarily accumulates updated values. The stored content constitutes the response data to the HTTP POST request sent from the client browser caused by the AutoConnectElements event.
The response
function has two overloads with different numbers of arguments. A response
function suitable for just one argument will only update the value of the AutoConnectInput. Also, a response
function suitable for two arguments allows updating all attributes of the HTML input type="text"
element derived from AutoConnectInput.
- Parameter
- valueSuitable for one argument format: A changing value of AutoConnectInput::value as response.
Suitable for two argument format: Specifies a value of the HTMLinput type="text"
element to be modified as specified in theattribute
argument. - attributeAn attribute name of an HTML
input type="text"
element to be changed.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectInput.
- Return value
- AC_Input
AutoConnectRadio¶
Constructor¶
AutoConnectRadio(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0, const ACPosterior_t post = AC_Tag_BR)
- Parameters
- nameThe element name.
- valuesAn array of values of the radio buttons. Specifies a std::vector object.
- labelLabel string.
- orderThe direction to arrange the radio buttons.
- checkedAn index to be checked in the radio buttons.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
checked¶
Specifies the index number (1-based) of the values to be checked. If this parameter is not specified neither item is checked.
- Type
- uint8_t
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
label¶
A label is an optional string. A label will be arranged in the left or top of the radio buttons according to the order.
- Type
- String
name¶
The element name.
- Type
- String
order¶
Specifies the direction to arrange the radio buttons. A label will place in the left or the top according to the order. It is a value of ACArrange_t type and accepts one of the following:
- Type
- ACArrange_t
AC_Horizontal
: Horizontal arrangement.AC_Vertical
: Vertical arrangement.
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
values¶
An array of String type for the radio button options. It is an initialization list can be used. The <input type="radio">
tags will be generated from each entry in the values.
- Type
- std::vector<String>
Public member functions¶
add¶
void add(const String& value)
Adds an option for the radio button.
- Parameter
- valueAn option string to add to the radio button.
canHandle¶
bool canHandle(void)
Returns whether the AutoConnectRadio element has a registered event handler and can respond to a change event.
- Return value
- trueAn event handler is registered. The element can correspond to a change event.
- falseAn event handler is not registered.
check¶
void check(const String& value)
Indicates the check of the specified option for the radio buttons. You can use the check function for checking dynamically with arbitrary of the radio button.
- Parameter
- valueAn option string to be checked.
empty¶
void empty(const size_t reserve = 0)
Clear the array of option strings that AutoConnectRadio has in the values. When the reserve parameter is specified, a vector container of that size is reserved.
The empty function resets the checked value to zero. When the empty function is executed, any button will be turned off.
- Parameter
- reserveReserved size of a container for the radio button option strings.
off¶
void off(void)
Release a registered event handler so that the element does not react to events.
on¶
void on(std::function<void(AutoConnectRadio&, AutoConnectAux&)> eventHandler)
Register an event handler function so that the element can respond to a change event.
- Parameter
- eventHandlerA function instance corresponding to a change event on AutoConnectRadio. It allows giving with lambda expressions.
An eventHandler function will be called when a change event occurs with the AutoConnectRadio. Its prototype declaration is follows:
void eventHandler(AutoConnectRadio& me, AutoConnectAux& aux)
- Parameter
- meA reference to the instance of the AutoConnectRadio that fired the change event.
- auxReference to the AutoConnectAux instance to which the AutoConnectRadio that generated the change event belongs.
operator [ ]¶
const String& operator[] (const std::size_t n)
Returns a value string of the index specified by n.
- Parameter
- nIndex of values array to return. Its base number is 0.
- Return value
- A reference of a value string indexed by the specified the n.
size¶
size_t size(void)
Returns number of options which contained.
- Return value
- Number of options which contained.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectRadio.
- Return value
- AC_Radio
value¶
const String& value(void) const
Returns current checked option of the radio buttons.
- Return value
- A String of an option current checked. If there is no checked option, a null string returned.
AutoConnectRange¶
Constructor¶
AutoConnectRange(const char* name = "", const int value = 0, const char* label = "", const int min = 0, const int max = 0, const int step = 1, const ACPosition_t magnify = AC_Void, const ACPosterior_t post = AC_Tag_BR, const char* style = "")
- Parameters
- nameThe element name.
- valueThe initial value in the range.
- labelLabel string.
- minThe most negative value within the range of allowed values.
- maxThe greatest value in the range of permitted values.
- stepThe granularity that the value must adhere to.
- magnifySpecifies the display position of the current value of the range.
- postSpecifies the tag to be output afterward the element.
- styleA style code with CSS format that qualifiers the range slider.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
label¶
A label is an optional string. A label is always arranged on the left side of the input box. Specification of a label will generate an HTML <label>
tag with an id attribute. The range slider and the label are connected by the id attribute.
- Type
- String
magnify¶
- Display position of the current value of the range.
- Type
- ACPosition_t
- AC_Infront : Displays the current value on the left side.
- AC_Behind : Displays the current value on the right side.
- AC_Void : No display the current value. This is the default.
max¶
The greatest value in the range.
- Type
- int
min¶
The most negative value within the range.
- Type
- int
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
step¶
The granularity that the value must adhere to.
- Type
- int
style¶
A style code with CSS format that qualifiers the range slider.
- Type
- String
value¶
Value of the element. It becomes a value attribute of an HTML <input type="range">
tag. A value of range in the custom Web page will be sent with a query string of the form.
- Type
- int
Public member functions¶
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectRange.
- Return value
- AC_Range
AutoConnectSelect¶
Constructor¶
AutoConnectSelect(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0, const ACPosterior_t post = AC_Tag_BR)
- Parameters
- nameThe element name.
- optionsAn array of options of the select element. Specifies a std::vector object.
- labelLabel string.
- selectedAn option should be pre-selected when the page loads.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
name¶
The element name.
- Type
- String
label¶
A label is an optional string. A label will be arranged in the top of the selection list.
- Type
- String
options¶
An array of String type for the selection options. It is an initialization list can be used. The <option value>
tags will be generated from each entry in the options.
- Type
- std::vector<String>
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
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¶
add¶
void add(const String& option)
canHandle¶
bool canHandle(void)
Returns whether the AutoConnectSelect element has a registered event handler and can respond to a change event.
- Return value
- trueAn event handler is registered. The element can correspond to a change event.
- falseAn event handler is not registered.
Adds a selectable option string for the selection list.
- Parameter
- optionA string of selectable item to be contained in the select element.
empty¶
void empty(const size_t reserve = 0)
Clear the array of options list that AutoConnectSelect has in the options. When the reserve parameter is specified, a vector container of that size is reserved.
The empty function resets the selected value to zero. When the empty function is executed, there are no selected options and the first item is placed at the beginning.
- Parameter
- reserveReserved size of a container for the options.
off¶
void off(void)
Release a registered event handler so that the element does not react to events.
on¶
void on(std::function<void(AutoConnectSelect&, AutoConnectAux&)> eventHandler)
Register an event handler function so that the element can respond to a change event.
- Parameter
- eventHandlerA function instance corresponding to a change event on AutoConnectSelect. It allows giving with lambda expressions.
An eventHandler function will be called when a change event occurs with the AutoConnectSelect. Its prototype declaration is follows:
void eventHandler(AutoConnectSelect& me, AutoConnectAux& aux)
- Parameter
- meA reference to the instance of the AutoConnectSelect that fired the change event.
- auxReference to the AutoConnectAux instance to which the AutoConnectSelect that generated the change event belongs.
operator [ ]¶
const String& operator[] (const std::size_t n)
Returns an option string of the index specified by n.
- Parameter
- nIndex 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
- valueString value that option should be selected in an option array.
size¶
size_t size(void)
Returns number of options which contained.
- Return value
- Number of options which contained.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectSelect.
- Return value
- AC_Select
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.
AutoConnectStyle¶
Constructor¶
AutoConnectStyle(const char* name = "", const char* value = "")
- Parameters
- nameThe element name.
- valueRaw CSS code to insert into a style block in a custom web page to generate.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
name¶
The element name.
- Type
- String
value¶
Raw CSS code to insert into a style block in a custom web page to generate.
- Type
- String
Public member functions¶
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectStyle.
- Return value
- AC_Style
AutoConnectSubmit¶
Constructor¶
AutoConnectSubmit(const char* name = "", const char* value ="", char* uri = "", const ACPosterior_t post = AC_Tag_None)
- Parameters
- nameThe element name.
- valueThe name of the submit button as an HTML `#!html ` tag, it will also be the label of the button.
- uriDestination URI.
- postSpecifies the tag to be output afterward the element.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
uri¶
Destination URI.
- Type
- String
value¶
The name of the submit button. It will also be the label of the button.
- Type
- String
Public member functions¶
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectSubmit.
- Return value
- AC_Submit
AutoConnectText¶
Constructor¶
AutoConnectText(const char* name = "", const char* value = "", const char* style = "", const char* format = "", const ACPosterior_t post = AC_Tag_None)
- Parameters
- nameThe element name.
- valueString of content for the text element.
- styleA style code with CSS format that qualifiers the text.
- formatA pointer to a null-terminated multibyte string specifying how to interpret the value. It specifies the conversion format when outputting values. The format string conforms to C-style printf library functions
- postSpecifies the tag to be output afterward the element.
Public member variables¶
enable¶
Enable HTML tag generation for the element.
- Type
- boolAutoConnect will generate the element into HTML only if the enable attribute is true.
format¶
The conversion format when outputting values. The format string conforms to C-style printf library functions.
- Type
- String
global¶
The global attribute copies input values between elements of the same name on different custom Web pages.
- Type
- boolAn entered value will be copied to elements of the same name in other AutoConnectAuxes during page transition.
However, it will be copied only when the destination element has the true for a global attribute.
name¶
The element name.
- Type
- String
post¶
Specifies a tag to add behind the HTML code generated from the element.
- Type
- ACPosterior_t
AC_Tag_None
: No generate additional tags.AC_Tag_BR
: Add a<br>
tag to the end of the element.AC_Tag_P
: Include the element in the<p> ~ </p>
tag.AC_Tag_DIV
: Include the element in the<div> ~ </div>
tag.
style¶
A style code with CSS format that qualifiers the text.
- Type
- String
value¶
A content string of the text element.
- Type
- String
Public member functions¶
response¶
void response(const char* value)
void response(const char* attribute, const char* value)
Reply the value or attribute of an element to the client. The response
is usually used for sending a reply to the client with the element's value or attribute that has been updated in an event handler function.
The response
function itself does not perform communication. It only temporarily accumulates updated values. The stored content constitutes the response data to the HTTP POST request sent from the client browser caused by the AutoConnectElements event.
The response
function has two overloads with different numbers of arguments. A response
function suitable for just one argument will only update the DOM text (i.e., the innerHTML
attribute dependent on the div
or span
node) of the AutoConnectText. Also, a response
function suitable for two arguments allows updating all attributes of the HTML div
or span
node derived from AutoConnectText.
- Parameter
- valueSuitable for one argument format: A changing value of AutoConnectText::value as response. It also will update the
innerHTML
attribute of thediv
orspan
node derived from AutoConnectText.
Suitable for two argument format: Specifies a value of the HTMLdiv
orspan
node to be modified as specified in theattribute
argument. - attributeAn attribute name of an HTML
div
orspan
node to be changed.
typeOf¶
ACElement_t typeOf(void)
Returns type of AutoConnectText.
- Return value
- AC_Text