pMe | (Object) Reference to the PmaWebDir object where the event rises. |
---|---|
pEvent | (Object) Reference to an object describing detailed information about the specific event.
pEvent.Method - (String) [for reading] 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.FilePath - (String) [for reading] Relative path to the file that is requested from the Web browser.
pEvent.Params - (String) [for reading] Text string that contains parameters in the URL.
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. pEvent.Data - (Variant) [for reading] It contains sent data (the request body content of the HTTP method POST).
The data are either in the form of the string for simple text form or in the form of the PmBuffer object for complex binary form. The data in the text for have the same form as parameters in the URL, so it can be read by the Pm.HTTPGetFormValue method. The data in binary form must be processed by the Pm.HttpFormDataParse method. |
<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>
pEvent.FilePath = "main.htm";
pEvent.Method = "POST";
pEvent.Data = "V1=33";
var sV1;
if (pEvent.FilePath == "main.htm")
{
sV1 = Pm.HTTPGetFormValue("V1", pEvent.Data);
// the value "33" is in the sV1 variable ...
}
<A href="main.htm?V1=33">Set V1=33</A>
http://user1/dir/main.htm?V1=33
var sV1;
if (pEvent.FilePath == "main.htm")
{
sV1 = Pm.HTTPGetFormValue("V1", pEvent.Params);
// the value "33" is in the sV1 variable ...
}
var oData = pEvent.Data;
if (Pm.GetVarType(oData, 1) == "PmBuffer")
{
var aParts = Pm.HttpFormDataParse(oData);
var iPart;
for (iPart = 0; iPart < oData.GetSize(1); iPart++)
{
var mPart = aParts.GetItem(iPart, -1);
Pm.Debug(mPart.Name);
Pm.Debug(mPart.File);
Pm.Debug(mPart.Type);
Pm.Debug(mPart.Value.GetSize());
}
}