From fc18be49aa1b980ac254b3c94e2ec14839fe9a83 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Wed, 4 Sep 2019 17:42:17 +0900 Subject: [PATCH] Describes the global attribute --- README.md | 3 +- mkdocs/achandling.md | 76 +++++++++++++++++++++++++-- mkdocs/apielements.md | 106 ++++++++++++++++++++++++++++++-------- mkdocs/changelog.md | 4 +- mkdocs/images/global1.png | Bin 0 -> 3925 bytes mkdocs/images/global2.png | Bin 0 -> 3639 bytes 6 files changed, 161 insertions(+), 28 deletions(-) create mode 100644 mkdocs/images/global1.png create mode 100644 mkdocs/images/global2.png diff --git a/README.md b/README.md index 73b73ff..4b4f7c6 100644 --- a/README.md +++ b/README.md @@ -101,11 +101,12 @@ Full documentation is available on https://Hieromon.github.io/AutoConnect, some ## Change log -### [1.0.0] Aug. 29, 2019 +### [1.0.0] Sept. 5, 2019 - Supports Arduino core for ESP32 1.0.3. - Supports AutoConnectUpdate for the OTA update. - Supports Preferences for saving credentials with ESP32 core 1.0.3 and later. **In ESP32, the credentials stored past in EEPROM will lose**. - Supports AutoConnectAux::isValid function. +- Supports the global attribute with all AutoConnectElements. ### [0.9.12] Aug. 18, 2019 - Fixed missing captive portal notifications on the newer mobile OS client. As a result of this fix, the SoftAP default IP address and gateway have been changed to **172.217.28.1**. (issue #85) diff --git a/mkdocs/achandling.md b/mkdocs/achandling.md index 7f4f797..e60ff64 100644 --- a/mkdocs/achandling.md +++ b/mkdocs/achandling.md @@ -594,6 +594,76 @@ portal.on("/echo", [](AutoConnectAux& aux, PageArgument& args) { portal.begin(); ``` +### Transfer of input values ​​across pages + +Since v1.0.0, AutoConnect supports a new attribute with each element that allows automatic transfer of input values across pages without sketching. AutoConnect will copy the input value of the elements with the [global](apielements.md#global_2) attribute to the same-named elements on a different custom web pages at the page transition timing. + +The **global** attribute will be useful for echoing input values back to another custom Web pages. The copy operation will be performed if the name matches and is global even if the copy source element and the destination have different types. Conversely, the value will not be copied unless the destination element is global. + +The following example reflects the input value of PAGE1 to the AutoConnectText field of PAGE2 without sketch code. + +```cpp hl_lines="8 10 28 30" +static const char PAGE1[] PROGMEM = R"( +{ + "title": "PAGE1", + "uri": "/page1", + "menu": true, + "element": [ + { + "name": "input1", + "type": "ACInput", + "global": true + }, + { + "name": "send", + "type": "ACSubmit", + "value": "OK", + "uri": "/page2" + } + ] +} +)"; +static const char PAGE2[] PROGMEM = R"( +{ + "title": "PAGE2", + "uri": "/page2", + "menu": false, + "element": [ + { + "name": "input1", + "type": "ACText", + "global": true + } + ] +} +)"; + +AutoConnect portal; +AutoConnectAux page1; +AutoConnectAux page2; + +void setup() { + page1.load(PAGE1); + page2.load(PAGE2); + portal.join( { page1, page2 }); + portal.begin(); +} + +void loop() { + portal.handleClient(); +} +``` + +
It's shown as like:
+ + + + +The value entered in **input1 declared in PAGE1** is reflected in **input1 of PAGE2** as AutoConnectText value even if there is no sketch code to transfer it to PAGE2. + +!!! note "Copy only for same-named and the global" + Copied only if the global attribute of the destination element is true. Even if the name of the destination element is the same, the copy is not performed if the global attribute is false. + ### Retrieve the values with WebServer::on handler ESP8266WebServer class and the WebServer class assume that the implementation of the ReqestHandler class contained in the WebServer library will handle the URL requests. Usually, it is sketch code registered by ESP8266WebServer::on function. @@ -713,10 +783,8 @@ By giving a [pattern](apielements.md#pattern) to [AutoConnectInput](apielements. } ``` -
- - -
+
It's shown as like:
+ If you are not familiar with regular expressions, you may feel that description very strange. Matter of fact, it's a strange description for those who are unfamiliar with the formal languages. If your regular expression can not interpret the intended syntax and semantics, you can use an online tester. The [regex101](https://regex101.com/) is an exceptional online tool for testing and debugging regular expressions. diff --git a/mkdocs/apielements.md b/mkdocs/apielements.md index 9f653c6..97fe309 100644 --- a/mkdocs/apielements.md +++ b/mkdocs/apielements.md @@ -27,10 +27,18 @@ HTML native code of the action script to be executed when the button is clicked. #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
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 @@ -98,15 +106,23 @@ Returns type of AutoConnectElement. 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**
-
Boolean
+
bool
#### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +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**
-
boolean
+
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 @@ -177,10 +193,18 @@ AutoConnectElement(const char* name = "", const char* value = "", const ACPoster #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
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 @@ -258,10 +282,18 @@ AutoConnectFile(const char* name = "", const char* value = "", const char* label #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +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**
-
boolean
+
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 @@ -364,10 +396,18 @@ AutoConnectInput(const char* name = "", const char* value = "", const char* labe #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
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 @@ -477,10 +517,18 @@ Specifies the index number (1-based) of the **values** to be checked. If this pa #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +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**
-
boolean
+
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 @@ -635,10 +683,18 @@ AutoConnectSelect(const char* name = "", std::vector const& options = {} #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
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 @@ -786,10 +842,10 @@ AutoConnectStyle(const char* name = "", const char* value = "") #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
boolAutoConnect will generate the element into HTML only if the enable attribute is true.
#### name @@ -840,10 +896,18 @@ AutoConnectSubmit(const char* name = "", const char* value ="", char* uri = "", #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +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**
-
boolean
+
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 @@ -916,10 +980,10 @@ AutoConnectText(const char* name = "", const char* value = "", const char* style #### enable -Enable HTML tag generation for the element. AutoConnect will generate the element into HTML only if the enable attribute is true. +Enable HTML tag generation for the element.
**Type**
-
boolean
+
boolAutoConnect will generate the element into HTML only if the enable attribute is true.
#### format diff --git a/mkdocs/changelog.md b/mkdocs/changelog.md index 1cbc429..6f8c1e8 100644 --- a/mkdocs/changelog.md +++ b/mkdocs/changelog.md @@ -1,9 +1,9 @@ -#### [1.0.0] Sep. 5, 2019 +#### [1.0.0] Sept. 5, 2019 - Supports Arduino core for ESP32 1.0.3. - Supports AutoConnectUpdate for the [OTA update](otaupdate.md). - Supports Preferences for saving credentials with ESP32 core 1.0.3 and later. **In ESP32, the credentials stored past in EEPROM will lose**. - Supports [**AutoConnectAux::isValid**](apiaux.md#isvalid) function. -- Supports the **global** attribute with all AutoConnectElements. +- Supports the [**global**](achandling.md#transfer-of-input-values-across-pages) attribute with all AutoConnectElements. #### [0.9.12] Aug. 18, 2019 - Fixed missing captive portal notifications on the newer mobile OS client. As a result of this fix, the SoftAP default IP address and gateway have been changed to **172.217.28.1**. diff --git a/mkdocs/images/global1.png b/mkdocs/images/global1.png new file mode 100644 index 0000000000000000000000000000000000000000..12218fcaaeab943b54ab55b1b3b8e69346d00fb2 GIT binary patch literal 3925 zcmbtXcT|(xvi}f;11NZqB60u~0qKec6ahs*dT-JZ>Ai;lApr%H76IvmqVy^qqy!Im zC>jtXL0aHQC<%l}uOTX?w@acYp>ZeYkhm~nLYFS&34Fj zO+qF~GccXk;HbWJw)9|G!?DIMta03&AN=BDnOACit=pWgk-AN-YCqZ*c}6toT9OjL(Lp_h`VU1eou$}mP?T4`MF8+G?@ z{=?M#Ob!ZKj^7Ed@L_}=cvgPTPv>c78a@2x_V%{h*;qOtA-Ls%m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