Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onPageAction - event of the PmaWebDir object

Description:
The event is triggered after sending parameters from the HTML document into the PROMOTIC application, for example after the HTML Form is filled in.
Parameters:
pMe(Object) Reference to the PmaWebDir object where the event rises.
pEvent(Object) Reference to object describing detailed information about the specific event.
pEvent.FilePath - (String) Relative path to the file that is requested from the Web browser.
pEvent.Method - (String) Name of the HTTP method by which the parameters were sent:
"POST" - Sending parameters from the HTML form
"GET" - Sending parameters as a part of the required new page
pEvent.Params - (String) Text string that contains values of individual elements from the HTML form. This string has the form, for example "a=13&b=xyz". It means that "a" has the value "13" and "b" has the value "xyz".

It is possible to separate individual values from this string by the Pm.HTTPGetFormValue method (see example).

Note:

The event is triggered after the PmaWeb.onNewRequest event and before creating the answer to the client (before loading and modifying the file pEvent.FilePath and before the PmaWebDir.onPageModify event).

The event is triggered only if the client that sends the data, has the "WebWrite" permission.

Example1:
Example of sending parameters from the HTML form (the "POST" method). The HTML form has, for example, the following content:
<html><head>
  <title>HtmlForm example</title>
</head>
<body>
  <form action="main.htm" method="POST">
    value:
    <input type="text" name="V1" value="22"/>
    <input type="submit" value="Send to the server"/>
  </form>
</body><html>
 
If the client enters the value, for example, 33 and it sends the form, then the onPageAction event is triggered on the server with the set values:
JavaScriptVBScriptSelect and copy to clipboard

pEvent.FilePath = "main.htm";
pEvent.Method = "POST";
pEvent.Params = "V1=33";
 
In the event, for example, this algorithm can be used:
JavaScriptVBScriptSelect and copy to clipboard

var sV1;
if (pEvent.FilePath == "main.htm")
{
sV1 = Pm.HTTPGetFormValue("V1", pEvent.Params);
//value "33" is in the sV1 variable ...
}
Example2:
Example of sending parameters as a part of the required new page from another HTML page (the "GET" method). In any HTML page there can be, for example, the reference:
<A href="main.htm?V1=55">Set V1=55</A>
Example3:
Example of sending parameters as a part of the required new page directly from the address line of the Web browser (the "GET" method). In the Web browser enter, for example:
http://user1/dir/main.htm?V1=55
PROMOTIC 9.0.12 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice