Supplemented the description about the isValid

pull/57/head
Hieromon Ikasamo 6 years ago
parent 525d3109f3
commit b34d43ec44
  1. 20
      docs/achandling.html
  2. 2
      docs/advancedusage.html
  3. 2
      docs/search/search_index.json
  4. 44
      docs/sitemap.xml
  5. BIN
      docs/sitemap.xml.gz
  6. 10
      mkdocs/achandling.md
  7. 2
      mkdocs/advancedusage.md

@ -592,6 +592,13 @@
Check data against on submission Check data against on submission
</a> </a>
</li>
<li class="md-nav__item">
<a href="#validate-input-data" title=" Validate input data" class="md-nav__link">
Validate input data
</a>
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
@ -980,6 +987,13 @@
Check data against on submission Check data against on submission
</a> </a>
</li>
<li class="md-nav__item">
<a href="#validate-input-data" title=" Validate input data" class="md-nav__link">
Validate input data
</a>
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
@ -1522,7 +1536,7 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh
<i class="fa fa-arrow-down"></i><br> <i class="fa fa-arrow-down"></i><br>
<i class="fa fa-eye"></i> It's shown as like:<span style="margin-left:14px;width:272px;height:118px;border:1px solid lightgray;"><img align="top" width="270" height="116" src="images/acow.png"></span></p> <i class="fa fa-eye"></i> It's shown as like:<span style="margin-left:14px;width:272px;height:118px;border:1px solid lightgray;"><img align="top" width="270" height="116" src="images/acow.png"></span></p>
<h3 id="check-data-against-on-submission"><i class="far fa-check-square"></i> Check data against on submission<a class="headerlink" href="#check-data-against-on-submission" title="Permanent link">&para;</a></h3> <h3 id="check-data-against-on-submission"><i class="far fa-check-square"></i> Check data against on submission<a class="headerlink" href="#check-data-against-on-submission" title="Permanent link">&para;</a></h3>
<p>By giving a <a href="apielements.html#pattern">pattern</a> to <a href="apielements.html#autoconenctinput">AutoConnectInput</a>, you can find errors in data styles while typing in custom Web pages. The pattern is specified by <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expression</a>.<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup> If the value during input of AutoConnectInput does not match the regular expression specified in the pattern, its background color changes to pink. The following example shows the behavior when checking the IP address in the AutoConnectInput field.</p> <p>By giving a <a href="apielements.html#pattern">pattern</a> to <a href="apielements.html#autoconnectinput">AutoConnectInput</a>, you can find errors in data styles while typing in custom Web pages. The pattern is specified by <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expression</a>.<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup> If the value during input of AutoConnectInput does not match the regular expression specified in the pattern, its background color changes to pink. The following example shows the behavior when checking the IP address in the AutoConnectInput field.</p>
<div class="codehilite" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="color: #f8f8f2">{</span> <div class="codehilite" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="color: #f8f8f2">{</span>
<span style="color: #f92672">&quot;title&quot;</span> <span style="color: #f8f8f2">:</span> <span style="color: #e6db74">&quot;Page-1&quot;</span><span style="color: #f8f8f2">,</span> <span style="color: #f92672">&quot;title&quot;</span> <span style="color: #f8f8f2">:</span> <span style="color: #e6db74">&quot;Page-1&quot;</span><span style="color: #f8f8f2">,</span>
<span style="color: #f92672">&quot;uri&quot;</span> <span style="color: #f8f8f2">:</span> <span style="color: #e6db74">&quot;/page1&quot;</span><span style="color: #f8f8f2">,</span> <span style="color: #f92672">&quot;uri&quot;</span> <span style="color: #f8f8f2">:</span> <span style="color: #e6db74">&quot;/page1&quot;</span><span style="color: #f8f8f2">,</span>
@ -1543,6 +1557,10 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh
<span style="display:block;width:306px;height:136px;border:1px solid lightgrey;"><img data-gifffer="images/aux_pattern.gif" data-gifffer-height="134" data-gifffer-width="304" /></span> <span style="display:block;width:306px;height:136px;border:1px solid lightgrey;"><img data-gifffer="images/aux_pattern.gif" data-gifffer-height="134" data-gifffer-width="304" /></span>
</div> </div>
<p>If you are not familiar with regular expressions, you may feel that description very strange. And matter of fact, it is a strange description for those unfamiliar with formal languages. If your regular expression can not interpret the intended syntax and semantics, you can use an online tester. The <a href="https://regex101.com/">regex101</a> is an exceptional online site for testing and debugging regular expressions.</p>
<h3 id="validate-input-data"><img src="images/regexp.png" align="top"> Validate input data<a class="headerlink" href="#validate-input-data" title="Permanent link">&para;</a></h3>
<p>The <a href="apielements.html#pattern">pattern</a> attribute of <a href="apielements.html#autoconnectinput">AutoConnectInput</a> only determines the data consistency on the web browser based on the given regular expression. In order to guarantee the validity of input data, it is necessary to verify it before actually using it.</p>
<p>You can validate input data from <a href="apielements.html#autoconnectinput">AutoConnectInput</a> using the <a href="apielements.html#isvalid">isValid</a> function before actually processing it. The <a href="apielements.html#isvalid">isValid</a> function determines whether the <a href="apielements.html#value_3">value</a> currently stored in <a href="apielements.html#autoconnectinput">AutoConnectInput</a> matches the <a href="apielements.html#pattern">pattern</a>. </p>
<h3 id="convert-data-to-actually-type"><i class="fa fa-exchange"></i> Convert data to actually type<a class="headerlink" href="#convert-data-to-actually-type" title="Permanent link">&para;</a></h3> <h3 id="convert-data-to-actually-type"><i class="fa fa-exchange"></i> Convert data to actually type<a class="headerlink" href="#convert-data-to-actually-type" title="Permanent link">&para;</a></h3>
<p>The values in the AutoConnectElements field of the custom Web page are all typed as String. A sketch needs to be converted to an actual data type if the data type required for sketch processing is not a String type. For the typical data type conversion method, refer to section <a href="datatips.html#convert-autoconnectelements-value-to-actual-data-type"><em>Tips for data conversion</em></a>.</p> <p>The values in the AutoConnectElements field of the custom Web page are all typed as String. A sketch needs to be converted to an actual data type if the data type required for sketch processing is not a String type. For the typical data type conversion method, refer to section <a href="datatips.html#convert-autoconnectelements-value-to-actual-data-type"><em>Tips for data conversion</em></a>.</p>
<h2 id="transitions-of-the-custom-web-pages">Transitions of the custom Web pages<a class="headerlink" href="#transitions-of-the-custom-web-pages" title="Permanent link">&para;</a></h2> <h2 id="transitions-of-the-custom-web-pages">Transitions of the custom Web pages<a class="headerlink" href="#transitions-of-the-custom-web-pages" title="Permanent link">&para;</a></h2>

@ -1453,7 +1453,7 @@ The above example does not connect to WiFi until TRIGGER_PIN goes LOW. When TRIG
<span style="color: #f8f8f2">AutoConnectConfig</span> <span style="color: #f8f8f2">config;</span> <span style="color: #f8f8f2">AutoConnectConfig</span> <span style="color: #f8f8f2">config;</span>
<span style="color: #66d9ef">void</span> <span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span> <span style="color: #66d9ef">void</span> <span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span>
<span style="background-color: #49483e"> <span style="color: #f8f8f2">config.apid</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;ap_portal&quot;</span> <span style="background-color: #49483e"> <span style="color: #f8f8f2">config.apid</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;ap_portal&quot;</span><span style="color: #f8f8f2">;</span>
</span><span style="background-color: #49483e"> <span style="color: #f8f8f2">config.psk</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;new_password&quot;</span><span style="color: #f8f8f2">;</span> </span><span style="background-color: #49483e"> <span style="color: #f8f8f2">config.psk</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;new_password&quot;</span><span style="color: #f8f8f2">;</span>
</span> <span style="color: #f8f8f2">portal.config(config);</span> </span> <span style="color: #f8f8f2">portal.config(config);</span>
<span style="color: #f8f8f2">portal.begin();</span> <span style="color: #f8f8f2">portal.begin();</span>

File diff suppressed because one or more lines are too long

@ -2,112 +2,112 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/index.html</loc> <loc>https://Hieromon.github.io/AutoConnect/index.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/gettingstarted.html</loc> <loc>https://Hieromon.github.io/AutoConnect/gettingstarted.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/menu.html</loc> <loc>https://Hieromon.github.io/AutoConnect/menu.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/basicusage.html</loc> <loc>https://Hieromon.github.io/AutoConnect/basicusage.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/advancedusage.html</loc> <loc>https://Hieromon.github.io/AutoConnect/advancedusage.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/acintro.html</loc> <loc>https://Hieromon.github.io/AutoConnect/acintro.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/acelements.html</loc> <loc>https://Hieromon.github.io/AutoConnect/acelements.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/acjson.html</loc> <loc>https://Hieromon.github.io/AutoConnect/acjson.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/achandling.html</loc> <loc>https://Hieromon.github.io/AutoConnect/achandling.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/api.html</loc> <loc>https://Hieromon.github.io/AutoConnect/api.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/apiaux.html</loc> <loc>https://Hieromon.github.io/AutoConnect/apiaux.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/apiconfig.html</loc> <loc>https://Hieromon.github.io/AutoConnect/apiconfig.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/apielements.html</loc> <loc>https://Hieromon.github.io/AutoConnect/apielements.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/apiextra.html</loc> <loc>https://Hieromon.github.io/AutoConnect/apiextra.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/howtoembed.html</loc> <loc>https://Hieromon.github.io/AutoConnect/howtoembed.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/datatips.html</loc> <loc>https://Hieromon.github.io/AutoConnect/datatips.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/menuize.html</loc> <loc>https://Hieromon.github.io/AutoConnect/menuize.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/wojson.html</loc> <loc>https://Hieromon.github.io/AutoConnect/wojson.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/lsbegin.html</loc> <loc>https://Hieromon.github.io/AutoConnect/lsbegin.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/faq.html</loc> <loc>https://Hieromon.github.io/AutoConnect/faq.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/changelog.html</loc> <loc>https://Hieromon.github.io/AutoConnect/changelog.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>https://Hieromon.github.io/AutoConnect/license.html</loc> <loc>https://Hieromon.github.io/AutoConnect/license.html</loc>
<lastmod>2019-03-05</lastmod> <lastmod>2019-03-10</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>

Binary file not shown.

@ -539,7 +539,7 @@ void loop() {
### <i class="far fa-check-square"></i> Check data against on submission ### <i class="far fa-check-square"></i> Check data against on submission
By giving a [pattern](apielements.md#pattern) to [AutoConnectInput](apielements.md#autoconenctinput), you can find errors in data styles while typing in custom Web pages. The pattern is specified by [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).[^2] If the value during input of AutoConnectInput does not match the regular expression specified in the pattern, its background color changes to pink. The following example shows the behavior when checking the IP address in the AutoConnectInput field. By giving a [pattern](apielements.md#pattern) to [AutoConnectInput](apielements.md#autoconnectinput), you can find errors in data styles while typing in custom Web pages. The pattern is specified by [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).[^2] If the value during input of AutoConnectInput does not match the regular expression specified in the pattern, its background color changes to pink. The following example shows the behavior when checking the IP address in the AutoConnectInput field.
[^2]:Regular expression specification as a pattern of AutoConnectInput is [JavaScript compliant](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). [^2]:Regular expression specification as a pattern of AutoConnectInput is [JavaScript compliant](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).
@ -564,6 +564,14 @@ By giving a [pattern](apielements.md#pattern) to [AutoConnectInput](apielements.
<span style="display:block;width:306px;height:136px;border:1px solid lightgrey;"><img data-gifffer="images/aux_pattern.gif" data-gifffer-height="134" data-gifffer-width="304" /></span> <span style="display:block;width:306px;height:136px;border:1px solid lightgrey;"><img data-gifffer="images/aux_pattern.gif" data-gifffer-height="134" data-gifffer-width="304" /></span>
</div> </div>
If you are not familiar with regular expressions, you may feel that description very strange. And matter of fact, it is a strange description for those unfamiliar with 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 site for testing and debugging regular expressions.
### <img src="images/regexp.png" align="top"> Validate input data
The [pattern](apielements.md#pattern) attribute of [AutoConnectInput](apielements.md#autoconnectinput) only determines the data consistency on the web browser based on the given regular expression. In order to guarantee the validity of input data, it is necessary to verify it before actually using it.
You can validate input data from [AutoConnectInput](apielements.md#autoconnectinput) using the [isValid](apielements.md#isvalid) function before actually processing it. The [isValid](apielements.md#isvalid) function determines whether the [value](apielements.md#value_3) currently stored in [AutoConnectInput](apielements.md#autoconnectinput) matches the [pattern](apielements.md#pattern).
### <i class="fa fa-exchange"></i> Convert data to actually type ### <i class="fa fa-exchange"></i> Convert data to actually type
The values in the AutoConnectElements field of the custom Web page are all typed as String. A sketch needs to be converted to an actual data type if the data type required for sketch processing is not a String type. For the typical data type conversion method, refer to section [*Tips for data conversion*](datatips.md#convert-autoconnectelements-value-to-actual-data-type). The values in the AutoConnectElements field of the custom Web page are all typed as String. A sketch needs to be converted to an actual data type if the data type required for sketch processing is not a String type. For the typical data type conversion method, refer to section [*Tips for data conversion*](datatips.md#convert-autoconnectelements-value-to-actual-data-type).

@ -414,7 +414,7 @@ AutoConnect portal;
AutoConnectConfig config; AutoConnectConfig config;
void setup() { void setup() {
config.apid = "ap_portal" config.apid = "ap_portal";
config.psk = "new_password"; config.psk = "new_password";
portal.config(config); portal.config(config);
portal.begin(); portal.begin();

Loading…
Cancel
Save