Demo 1

Demo 1 is composed of a small HTML file called demo1.html and an SM32 program called DEMO1.
demo1.html has a form with an input Text Box, a Check Box and 2 submit Buttons.
Following is the contents of the demo1.html:

<html>
<head>
<title>This is DEMO 1</title>
</HEAD>

<body>
<H2> DEMO 1</h2>
<form method="post" action="FORMINPUT">
  <B>Enter String: </b>
  <input TYPE="Text" NAME="STRING" SIZE=40 VALUE="Enter something Here"><BR><br>
  <B>Check or Uncheck this checkbox</b><br>
  <B>Check Box: </b><input type="Checkbox" value="CHECKED" name="CHECKBOX"><BR>
  <BR>
  <input type="submit" name="CANCEL" value="Cancel">  
  <input type="submit" name="DOIT" value="  Do It  ">
</form>
</body>
</html>
Note the form method is post, this is required by the Load Html utility.
The prefix used for the demos was D_ so the Load Html Utility creates the program D_DEMO1 from demo1.html.

The following program DEMO1 tests the D_DEMO1 program:

010 REM "DEMO1"
100 REM 100,5
105 DIM P!
110 PRINT 'gwin'("WEB"),
115 CALL "D_DEMO1",P![ALL]
120 REM "Don't accept Enter as end of input"
125 IF P!["CANCEL"]="" AND P!["DOIT"]="" THEN LET P!["FLAG"]="NoDisplay";GOTO 0115
130 PRINT 'gwin'("CONSOLE"),
135 PRINT "The Program D_DEMO1 returned because:"
140 IF P!["CANCEL"]<>"" THEN PRINT "Cancel button was hit"
145 IF P!["DOIT"]<>"" THEN PRINT "Do It button was hit"
150 PRINT ""
155 PRINT "The textbox contains:"+$22$+P!["STRING"]+$22$
160 PRINT "The Check Box is ",
165 IF P!["CHECKBOX"]<>"" THEN PRINT "Checked" ELSE PRINT "Unchecked"
The 'gwin'("WEB") causes the web view to be the current view.
The call to D_DEMO1 will display what were the contents of demo1.html.

When D_DEMO1 returns P! will contain the following:
P!Value
["url"]=DIR(-1)+"HTML\FORMINPUT" - "FORMINPUT" is the ACTION= from the FORM tag
["STRING"]=the contents of the text box
["CHECKBOX"]="" if not checked or
"CHECKED" if checked - "CHECKED" is the VALUE= from the the INPUT tag
["DOIT"]="" if the Do It button was not pressed or
" Do It " if it was - " Do It " is the VALUE= from the the INPUT tag
["CANCEL"]="" if the Cancel button was not pressed or
" Cancel " if it was - " Cancel " is the VALUE= from the the INPUT tag
Note that line 125 is checking for an Enter in the text box. If neither Cancel or Doit was hit it must be enter from the text box. Setting the "NoDisplay" FLAG causes D_DEMO1 to just wait for another input.