onPageAction - event of the PmaWebDir object
The event is triggered after sending parameters from the HTML document into the PROMOTIC application, for example after the HTML Form is filled in.
|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
Relative path to the file that is requested from the Web browser.
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
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"
has the value "xyz"
It is possible to separate individual values from this string by the Pm.HTTPGetFormValue method (see example).
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.
Example of sending parameters from the HTML form (the "POST" method). The HTML form has, for example, the following content:
<form action="main.htm" method="POST">
<input type="text" name="V1" value="22"/>
<input type="submit" value="Send to the server"/>
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:
pEvent.FilePath = "main.htm";
pEvent.Method = "POST";
pEvent.Params = "V1=33";
In the event, for example, this algorithm can be used:
if (pEvent.FilePath == "main.htm")
sV1 = Pm.HTTPGetFormValue("V1", pEvent.Params);
//value "33" is in the sV1 variable ...
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>
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: