ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Page functions
  • Retrieving a value that is not linked to a control
  • Retrieving the parameters passed to an AWP or PHP page
  • Example of URL used to run a WEBDEV site by passing parameters
  • Retrieving the parameters sent to the page from a WINDEV or WINDEV Mobile application
  • Pre-launched sessions
  • PHP4
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
PageParameter (Function)
In french: PageParamètre
Returns the value of a parameter passed to the current page. Used to retrieve:
  • the parameters of a command line.
  • a value that is not linked to a control (position of the mouse in a clickable image).
// Project initialization code
SWITCH Upper(PageParameter("HOMEPAGE"))
CASE "LOGIN": PageDisplay(PAGE_Identification)
CASE "PRODUCTS": PageDisplay(PAGE_ProdMgt)
OTHER CASE: // No action
END
// Retrieve the position of the mouse in a clickable image
Parameter is string = PageParameter("POS") 
// Ex: Parameter ="15,23"
x,y are int
x = ExtractString(Parameter, 1, ",")
y = ExtractString(Parameter, 2, ",")
WEBDEV - Server codeAjax
// Retrieve the position of the mouse in a clickable image
Parameter is string = PageParameter(1) 
// Ex: Parameter = "POS=15,23"
Syntax

Retrieving the value of a parameter identified by its name Hide the details

<Result> = PageParameter(<Parameter name> [, <Encoding>])
<Result>: Character string
  • Value of specified parameter,
  • Empty string ("") if the parameter does not exist or if it has no value.
<Parameter name>: Character string
Name of the parameter whose value must be returned. For an Active WEBDEV Page, the parameters are automatically named by WEBDEV (P1, P2, ..., P256). In this case, no controls named P1, P2, ..., P256 must be found in the page.
<Encoding>: Optional Integer constant
Encoding of the value of the parameter:
paramNoDecodingThe raw value of the parameter is returned. No decoding is performed by WEBDEV. This constant can be used when the encoding of the URL does not comply with the standards used by WEBDEV (e.g., "+" sign not supported, etc.)
paramWithDecoding
(Default value)
The parameter value is automatically decoded by WEBDEV according to the encoding/decoding standard of URLs.
WEBDEV - Server codeAjax

Retrieving the value of a parameter identified by its index Hide the details

<Result> = PageParameter(<Parameter index> [, <Encoding>])
<Result>: Character string
  • Value of specified parameter. This value has the following format: <Parameter name> = <Value>.
  • Empty string ("") if the parameter does not exist.
<Parameter index>: Integer
Index of the parameter whose value must be returned.
<Encoding>: Optional Integer constant
Encoding of the value of the parameter:
paramNoDecodingThe raw value of the parameter is returned. No decoding is performed by WEBDEV. This constant can be used when the encoding of the URL does not comply with the standards used by WEBDEV (e.g., "+" sign not supported, etc.)
paramWithDecoding
(Default value)
The parameter value is automatically decoded by WEBDEV according to the encoding/decoding standard of URLs.
WEBDEV - Server codeAjax

Retrieving specific data Hide the details

<Result> = PageParameter(<Type of message>)
<Result>: Character string
  • Data sent by HTTPRequest.
  • Empty string ("") if no data.
<Type of message>: Integer constant
Type of data to retrieve:
paramBufferRetrieves the rough data that was received (sent by a POST method). The data received must use one of the following MIME types:
  • "application/octet-stream".
  • "text/xml".
Remark: If this constant is used, the page test can only be run by using HTTPRequest to send the message. A simple GO of the page does not work.
Remarks

Retrieving a value that is not linked to a control

By default, the parameters sent by the browser are usually assigned to the controls found in the context, before any process is run. PageParameter gets a value that is not linked to a control.
Example: PageParameter gets a position in a clickable image.
You can get the horizontal and vertical position of the cursor in the click area via a specific parameter: "POS" (see the example).

Retrieving the parameters passed to an AWP or PHP page

PageParameter retrieves the value of the parameters passed to the page. Several possibilities exist according to the type of page:
  • Retrieval according to the name of the parameter
  • Retrieval according to the parameter index
Case 1: Retrieval according to the parameter name
The name of the parameter was specified in the URL of the page.
For an AWP or PHP page, the parameters are automatically renamed by WEBDEV (P1, P2, ..., P256). In this case, no controls named P1, P2, ..., P256 must be found in the page.
1. Code used to display the page by passing parameters:
// In the "MyPage.AWP" page, displays the 350th element
// of "Instruments" category
PageDisplay(PAGE_MyPage, "Instruments", 350)
2. Code used to retrieve the parameters:
// Retrieve the parameters
SoughtCategory is string = PageParameter("P1")
SoughtID is int = PageParameter("P2")


Case 2: Retrieval according to the parameter index
The parameter index corresponds to the order in which the parameters were passed in the page URL.
PHP This syntax is not available in this version.
1. Code used to display the page by passing parameters:
// In the "MyPage.AWP" page, displays the 350th element
// of "Instruments" category
PageDisplay(PAGE_MyPage, "Instruments", 350)
2. Code used to retrieve the parameters:
// Retrieve the parameters
SoughtCategory is string = PageParameter(1)
// SoughtCategory = "P1=Instruments"
SoughtCategory = Right(Length(SoughtCategory)-3)
SoughtID is int = PageParameter(2)
// SoughtID = "P2=350"
SoughtID = Right(Length(SoughtID)-3)
WEBDEV - Server codeAjax

Example of URL used to run a WEBDEV site by passing parameters

http://Server/WD280AWP/WD280AWP.EXE/CONNECT/APPLI?PARAM1=VAL1&PARAM2=VAL2&PARAM3=VAL3
In this code:
  • server corresponds to the server address,
  • APP corresponds to the name of the WEBDEV site,
  • PARAM1, PARAM2 and PARAM3 correspond to the names of the parameters,
  • VAL1, VAL2 and VAL3 correspond to the values of the different parameters.
Each parameter is retrieved in WLanguage, in the project initialization code. For each parameter, use PageParameter and specify the name of the parameter to retrieve.
For example:
// Retrieve the parameter named PARAM1
PageParameter("PARAM1")
WEBDEV - Server codeAjax

Retrieving the parameters sent to the page from a WINDEV or WINDEV Mobile application

If the value of a received parameter was sent by a WINDEV or WINDEV Mobile application with HTTPRequest and if it was encoded by URLEncode, there is no need to decode this value. PageParameter will automatically perform the decode operation (call to URLDecode).

Pre-launched sessions

If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must be used in the "Initializing the project after connection to the site" event.
PHP

PHP4

In PHP4, to retrieve the rough value of parameters (paramBuffer constant or paramNoDecoding constant), the "always_populate_raw_post_data" directive must be set to "on" in the configuration file of PHP (php.ini file).
Related Examples:
WW_Organizer Training (WEBDEV): WW_Organizer
[ + ] The WW_Organizer example is an example for using the Organizer control of WEBDEV.
Component: wd290page.dll
Minimum version required
  • Version 9
Comments
Documentation Issue with paramBuffer Constant
It says that to use the paramBuffer constant, you have to use MIME types application/byte-stream or text/xml

However application/byte-stream is not a proper MIME type it should be application/octet-stream, the French help page has it correctly

I suspect it was just accidentally translated in the English Page

Note if you try application/byte-stream, the PageParameter function fails causing a runtime error saying the Query is empty.
Pete
15 Dec. 2016

Last update: 10/26/2023

Send a report | Local help