App Developer Webserver

Discuss PC Developer and Web Developer projects and features here.
Post Reply
wayne_millard
Posts: 94
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

App Developer Webserver

Post by wayne_millard »

Hi Everyone,

Is there a basic example of an webserver running in App developer. This web page with buttons and LEDs and how to pass the button press and control on LEDs.

Thanks,
Wayne Millard :D

BenR
Matrix Staff
Posts: 1726
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 438 times
Been thanked: 602 times

Re: App Developer Webserver

Post by BenR »

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.
AppDev_Webserver_LED.fcsx
(16.96 KiB) Downloaded 174 times
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.

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: App Developer Webserver

Post by wayne_millard »

Hi Ben,

I have tried you example and thanks for that i have a problem that when i press the submit button it takes me to page2 and does not take me back to index page.

Thanks,
Wayne Millard :)

BenR
Matrix Staff
Posts: 1726
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 438 times
Been thanked: 602 times

Re: App Developer Webserver

Post by BenR »

Hi Wayne,

Hmm that's interesting what browser are you using, I was using Firefox and it was working 100% of the time.

Maybe try increasing the refresh time to 2 or 3 seconds and see if that helps?

Post Reply