Hi Wayne,
This works pretty well, it sends the form data to page 2 which collects and parses the input before redirecting back to the index control page.
The reason for the second page is that we can process the input and assign the output and this way the status text for the LED is correct and not a refresh behind as it would be with a single page.
Input 0 controls the LED state and is either "" for off or "ON" for on.
Output 0 controls the LED state text reported on the index page and is "OFF" for off and "ON" for on.
Output 1 controls the checkbox state to ensure the user's last input is remembered. It has the values "" for off and "checked " for on.
index.htm HTML
Code: Select all
<html>
<body>
<h1>Flowcode App Developer Webserver</h1>
LED is %0 <br />
<form action="/page2.htm">
<input type="checkbox" id="0" name="0" value="ON" %1 >
<label for="0"> LED Control</label><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
page2.htm HTML
Code: Select all
<meta http-equiv="refresh" content="1; URL=/index.htm" />
If you wanted you could get rid of the submit button and add some javascript to auto submit the form on change.