Usage of cgi to send values to the ws10 – NOVUS Web Server – WS10 User Manual
Page 19

Web Server – WS10
NOVUS AUTOMATION
19/33
USAGE OF CGI TO SEND VALUES TO THE WS10
An HTML formulary can write to a WS10 register using the POST method. The WS10 built in CGI script associate the formulary values to the WS10
registers. The example 3 show the use of the POST method to write on the WS10 real time clock registers and on 3 other registers.
The CGI script name defined at the [Auth] section of the WEBS.CFG file must match to the name used at the page Forms. The default name
procform is used on the example and shown below:
<FORM ACTION=
procform
METHOD=POST>
The name of the page to be presented after the form post can be defined. This definition is optional, and the same form page will be reloaded if not
defined. At example 3, the following hidden field is used to define the next page to be presented:
<INPUT TYPE=HIDDEN NAME=nextpage VALUE=data.htm>
It is important to examine the following field definition extracted from example 3:
<INPUT TYPE=TEXT NAME=_INTERNAL_/FT1TOT SIZE=7 VALUE=%_INTERNAL_/FT1TOT%>
In this field, the first usage of the tag
_INTERNAL_/FT1TOT
is not enclosed by the percent characters, since we don’t want the WS10 to
replace the name by the corresponding value. The tag name must remain untouched to inform to the WS10 CGI script the name of the destination
register for the written data. The second usage of the same tag is enclosed by the percent characters to allow the WS10 to replace the tag name
with the corresponding value, which will be used as the initial value for the form field.
Date/Time<br><br>
<script language="JavaScript" type="text/JavaScript">
<!--
function goback()
{
document.location='data.htm';
return false;
}
function cNum(x)
{
if (x >= 0 && x < 10)
return '0' + x;
else
return '' + x;
}
document.write('<FORM ACTION=procform METHOD=POST>\
<INPUT TYPE=HIDDEN NAME=nextpage VALUE=data.htm>\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_MONTH
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_MONTH%
)+'>/\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_DAY
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_DAY%
)+'>/\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_YEAR
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_YEAR%
)+'><br>\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_HOUR
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_HOUR%
)+'>:\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_MIN
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_MIN%
)+'>:\
<INPUT TYPE=TEXT NAME=
_INTERNAL_/_SEC
SIZE=1 VALUE='+cNum
(%_INTERNAL_/_SEC%
)+'><br><br>\
<INPUT TYPE=SUBMIT NAME=button VALUE="Set Date/Time" ></FORM>');
//-->
</script>
<FORM ACTION=procform METHOD=POST>
<INPUT TYPE=HIDDEN NAME=nextpage VALUE=data.htm>
FT1 Totalization: <INPUT TYPE=TEXT NAME
=_INTERNAL_/FT1TOT
SIZE=7 VALUE=
%_INTERNAL_/FT1TOT%
>
<INPUT TYPE=SUBMIT NAME=button VALUE="Apply">
</FORM>
<FORM ACTION=procform METHOD=POST>
<INPUT TYPE=HIDDEN NAME=nextpage VALUE=data.htm>
OUT1: <INPUT TYPE=TEXT NAME=
_INTERNAL_/OUT1
SIZE=1 VALUE=
%_INTERNAL_/OUT1%
>
<INPUT TYPE=SUBMIT NAME=button VALUE="Apply"><br>
</FORM>
<FORM ACTION=procform METHOD=POST>
<INPUT TYPE=SUBMIT NAME=button VALUE="Back" onClick='return goback();'>
</FORM>
</b></center></font>
</body>
</html>
Example 3 – Write to the WS10 using formula with the POST method
The WS10 memory registers are useful to control some internal functions using HTML pages. Pages can write to memory registers used for:
•
Enable, disable or clear the data logger file
•
Trigger an email
•
Define alarms setpoints
•
Activate an alarm
Screenshots of the 3 examples are presented at the appendix A.