- 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
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).
// Initialization code of project 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, ",")
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:
| | paramNoDecoding | The 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. |
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 indexThe parameter index corresponds to the order in which the parameters were passed in the page URL.
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)
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.
Related Examples:
|
Training (WEBDEV): WW_Organizer
[ + ] The WW_Organizer example is an example for using the Organizer control of WEBDEV.
|
|
|
|