pCOWeb
+030220966 – rel. 1.1 – 12.12.2017
69
To enter a variable write operation on an html page, use the
<form>
statement (for the syntax of <form>, see the documents on the HTML language at
http://www.htmlhelp.com/reference/wilbur/block/form.html
). Inside the form section, the
var
tag is used together with the
“
script
” statement.
Example (
Figure
G.b and Figure G.c on page 69)
Writing a new value for the integer variable with index 9 (note: to try this example on
pCOWeb
, replace index 9 with the index of a read/write variable for the
application loaded on the
pCO
).
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--tagparser="/pcotagfilt"-->
<head>
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
<title>pCOWeb Demo Page</title>
</head>
<body bgcolor='#ffffff'>
<h1 style="text-align: center">pCOWeb Demo Page</h1>
<br>
<form method="GET" action="example.html">
<input type="text" name="?script:var(0,3,9,-32768,32767)" value="<%var(0,3,9)%>">
<input type="submit" value="Submit">
</form>
</body>
</html>
The
?script:var(0,3,9,-32768,32767)
section places a text box on the page for entering the value using the keyboard.
The
<%var(0,3,9)%>
section fills the text box with the value of the variable; if omitted, the value will not be indicated.
Figure G.b - The “var” TAG used for writing
After having entered a new value, selecting the Submit button sends
pCOWeb
the value entered for the variable and a new request for the page specified in the
“form” statement (“example.html”).
pCOWeb
will perform the following operations:
1.
send the value entered to the
pCO
(for multiple variables, it will send all the values entered);
2.
wait to receive the echo of the value sent by the
pCO
(for multiple variables, it will wait for the echo of all the values);
3.
when the echo is received, the value will be written to the table on the
pCOWeb
and the page will be returned to the PC (for multiple values, it will wait for the
last echo to be received); the fields will contain the values received as echoes from the
pCO
.
Figure G.c - The “var” TAG used for writing: write completed
NOTE The
pCO
does NOT send an echo in the following cases:
•
the
pCO
is sent the same value as already saved for the variable;
•
one of the situations in which “var” returns “U” (see above, description of “var” for reading).
If waiting for some echo,
pCOWeb
will return the page to the PC after a Timeout of 10 seconds from the reception of the last echo; the fields relating to the
variables for which no echo has been received will contain the values saved prior to the variations being sent. For further details see APPENDIX C on page 62.