Before creating your site, it is advised to read the documentation:Before beginning.
The dynamic link is a token used to deal with mouse clicks on sensitive zones of the HTML page: <a> tags and <input type='button'> tags.
<input type='button' adx="MyDynamicLink" value="Click here">
<a adx="MyDynamicLink">Click here</a>
The three main setups of a dynamic link are:
1. Web action,
2. The destination web page,
3. the selection.
The order of the list is the order according to which these setups are processed by the XTEND server.
There are two types of actions:
Each action is declared in the dictionary for a setup record.
This is the page displayed after the request has been posted on the server.
Each page is declared in the dictionary for a setup record.
The destination page can be modified by the action.
To modify the destination page per program (4LG), the user must use dynamic links sequence (programmed sequence):
Value a parameter of the sub-program using the code of the dynamic link (with or without action/selection) which points to the destination page.
The dynamic link can post a selection to the target page's man section in order to modify the selection criteria.
The selection enables the user to manage the link detail list, the sort of the tables or the refining of the requests.
For further information, see the documentation on the Section Tokens.
The following setups are taken into account by dynamic links.
Code | Parameters | Description |
xacceptreload | None | Forces the action of the dynamic link to execute the reload of the HTML page (F5) even if the reload is blocked in the setup of the action ('Active on reload') |
xparams | QueryString | Adds setups in the dynamic link URL |
<a adx="MyDynLink:xacceptreload&xparams=?PARCOD1=VAL1~PARCOD2=VAL2#xtdbottom">
This example:
The following example showis how to position an object in a destination page (via HTML setup xparams) when the user clicks on a dynamic link:
<!--Dynamic link in the original page-->
<input type="button" value="Click here" adx="MYDYNLINK:xparams=#bookmark">
<a adx="MYDYNLINK:xparams=#bookmark">Click here</a>
<!--Destination page-->
</body>
<!--Code HTML -->
<a name="bookmark">
<!--Positioning of the page when the user clicks the button above-->
<!--Code HTML -->
</body>
The following example shows the valuation of PACOD1 and PARCODE (user variables) with VAL1 and VAL3 (via HTML setup xparams) when the user clicks on a dynamic link:
<!--Dynamic link in the original page-->
<input type="button" value="Click here" adx="MYDYNLINK:xparams=?PARCOD1=VAL1~PARCOD2=VAL2">
<a adx="MYDYNLINK:xparams=?PARCOD1=VAL1~PARCOD2=VAL2">Click here</a>
The detail list link consists in defining a link to access the detail of an entity displayed in a list.
For example: access the detail of the item via the catalog.
The page details generally contains futher information from other tables than the one used to display the list.
For instance, the rich description record of a product or associated products (cross-selling).
Conversely, the user will have to return to the list from the detail page without losing the context of the list (selection criteria, paging...).
The dynamic link selects an entity so that the code is the same as the current line code.
The current line is identified by the ACURRENT section (top of the the data context stack).
The link "Replace the selection of the main section".
<table>
<tr>
<th><b>Code</b></th>
<th><b>Label</b></th>
</tr>
<!--List section-->
<!adx="BLKITMLST">
<tr>
<!--Link to detail-->
<td><a adx="DLKDETAIL"><span adx="CODE"></span></td>
<td adx="DESCR"></td>
</tr>
<!adx="BLKITMLST">
</table>
The mono-entry section has a selection of the type "Lat clicked link" in order to use the selection criteria of the dynamic link clickedby the user (which has been created previously via the selection on ACURRENT.CODE).
<!--Detail section-->
<!adx="BLKDETAIL">
<b>Code </b><span adx="CODE"></span><br>
<b>Label </b><span adx="DESCR"></span><br>
<b>Price </b><span adx="PRIX"></span><br>
<b>Stock </b><span adx="STOCK"></span><br>
<!adx="BLKDETAIL">
<!--Back to the list-->
<a adx="DLKRETOURLISTE">back to list</a>
To display further data coming from another table or view (a rich description of an item or associated products, for instance):
ADLKRETURN dynamic link is used to return back to XTEND pages that have been viewed.
For example:
If a product catalogue is paged, ADLKRETURN (link) will display the page that was before the display of the catalogue and will not take into account paging actions as the browser "Back" button.
The XTEND engine manages a stack of pages viewed by user session which size can be determined via the configuration setup:
xtend.server.gensetup.misc.rtnstacksize (20 by default).
Code | Parameters | Action | Description |
ADLKFIRSTPAGE | No | ABLKFIRSTPAGE | Used to display the first page of a block |
ADLKNEXTPAGE | No | ABLKNEXTPAGE | Used to display the next page of a block |
ADLKLASTPAGE | No | ABLKLASTPAGE | Used to display the last page of a block |
ADLKSELECT | No | ABLKSELECT | Used to select the line of a block |
ADLKUNSELECT | No | ABLKUNSELECT | Used to deselect the selected line of a block |
ADLKRESTOREFORM | No | ARESTOREFORM | Used to restore an HTML form with the initial values |
ADLKRESTORESESSION | No | ARESTORESESSION | Used to display the last open page before closing the browser |
ADLKLOGIN | Yes | ASESSLOGIN | User login |
ADLKLOGOUT | No | ASESSLOGOUT | Used to logout the user |
ADLKSWITCHCOOKIES | No | ASESSSWITCHCOOKIES | Used to exchange the modes 'without cookies' and 'with cookies' |
ADLKTRACESET | No | ATRACESET | Update of the XTEND log |
ADLKRETURN | No | No | Return to previous page |
ADLKPOSTPAGE | No | No | Posts the form of the current page and returns to the same page |
ADLKSWITCHSITE | Yes | No | Opens another XTEND site |
ADLKSWITCHLANG | Yes | No | No Change of user language |
Fields
The following fields are present on this tab :
| Code of the dynamic link. |
| Current Web site |
| [object Object] |
Close
Presentation
General setups of dynamic link.
"Param" table Access sub-program" is filled up if the following conditions are met:
When is grid is not empty, it is used to define a selection on these setups.
Close
Fields
The following fields are present on this tab :
Milestone
| Select 'yes' to track the calls of the dynamic link in the XTEND server log. |
| Select 'yes' to used the HTTP GET method; the link must be taken into account by the search engines (web crawlers). Only the links that do not have any contextual parameter for the selection and/or the action are compatible with the HTTP GET method. |
Destination
| Select:
|
| Destination page. |
Dynamism
| Code of the selected entity if the dynamic link applies a selection for the main block of the destination page. The entity is used to help with the entry of the selection criteria in the selection tab. |
| There are three types of modification of a block criteria via a dynamic link: 1. The criteria of the dynamic link 'Replaces the main block selection'BLOCK SELECTION = LINK SELECTION CRITERIA 2. The criteria of the dynamic link 'is added to the main block selection':Refines the block request with the link criteria. 3. The criteria of the dynamic link 'is added up to the current main block selection'Refines the block request by adding the dynamic link selection (AND logic) to the current block request. Restriction: |
| Code of the web action if the dynamic link has an action. The action parameters are automatically displayed in the parameter block of the Advanced tab to specify the way they will be valued. |
| Tick the box so that the action parameters declared as 'Mandatory web fields' could automatically be checked by XTEND. |
Grid Param sub-routine access
| Code of the sub-program setup. |
|
|
|
|
| Block code for the 'Field token' origin. |
| Block entity for the 'Field token' origin. |
| Field code for the 'Field token' origin. |
Close
Fields
The following fields are present on this tab :
Grid Parameters
| Action setup code. |
|
|
|
|
| Block code for the 'Field token' origin. |
| Block entity for the 'Field token' origin. |
| Field code for the 'Field token' origin. |
Sequencing
| This is the page that will be displayed if the action exits as an error. The XTEND engine considers that an action has failed if the web service invoked has returned at least one error message. |
| 'Yes' to specify that it is the L4G processing that returns the code of the dynamic link in a sub-program setup. Dynamic sequencing defined by the L4G processingThe L4G processing can decide the link to sequence by returning the link code in a sub-program setup.
The code of the dynamic link can also be stored in a session variable (user variable).
The page displayed following the sequencing of several dynamic links is the web page associated with the last dynamic link processed. |
|   |
|   |
Grid Links
| Code of the dynamic link to be execute. List of the dynamic links: the dynamic links entered in the list will be executed sequentially as long as an error is not returned to the web service. |
Close
Presentation
The dynamic link has the capacity to post a selection to the main section (AMAIN) of the destination page. If the section selection can be "altered" and if selected entities are similar, the section will consider the selection posted by the dynamic link (according to the "Selection application" setup).
Fields from this tab are active only if an entity code has been selected in "Selection on entity" in the "General" screen.
Close
Fields
The following fields are present on this tab :
Characteristics
| None: all the records are selected. Query: the selection criteria of the section are applied. Last link clicked: are applied the selection criteria of the dynamic link which has been clicked to access the page containing the section. |
| No: the SQL query associated with the section cannot be modified using the query of a dynamic link. Yes: the query cannot be modified using the query associated with a dynamic link. The query of the section is the default query. |
| Selection of the optimization submitted by the interface. None: No optimization No image file: the interface does not return the 'image file' type field No text file: the interface does not return the 'text file' type field Neither image file nor text file: the interface does not return the 'image file' and 'text file' type fields |
Selection synthesis
| Query of the section in text format |
Grid Selection criteria
| Logical operation sequencing operator. |
| Opening brackets. |
| Field of the entity whose value is the first operand of the operation. |
| Comparison operator |
|
|
| The parameter value is entered here. Depending on the case, this value is entered as if it were a number, a date or an alphanumeric code. When the parameter is of local menu type, it is possible to enter either the beginning of the name or the numeric value corresponding to the position of the name in the list. When the code is controlled by an annex table, a selection key may be used to select it. |
| Block code for the 'Field token' origin. |
| Name of the block for the 'Field token' origin. |
| Field code for the 'Field token' origin. |
| Closing brackets. |
|
|
|   |
Entity
| Specifies the entities that will be created from the result of the query. |
| 'Data access" type interface which will be called. |
| 'Data access" type interface which will be called. |
Close
Fields
The following fields are present on this tab :
Characteristics
| Select a sort type:
|
|
|
Grid Sort
| Name of the field for the 'Field token' origin. |
| Ascending/descending sort order. |
Close
By default, the following reports are associated with this function :
PRTSCR : Screen print
This can be changed using a different setup.
This button is used to copy a dynamic link. |
A dynamic link token is always inserted as attribute of an HTML tag <a> or <input type='button'>.
When the XTEND server dynamically builds the HTML page : it calls a JavaScript function from XTEND (stdDoDIk) library on the event onClick, at the level o the dynamic link tokens.
Setup from the function xtdDoDlk are contextual and will be used by the XTEND library to constitute data (xml) to send to the XTEND server in order to process the action and the selection.
<a href="javascript:xtdDoSubmit('MYDLK',null);"
onclick="xtdDoDlk(this,'MYDLK',null,null,'XAA',0,null,event,false,'_1',false,null,false);">
<input type="button"
onclick="xtdDoDlk(this,'MYDLK',null,'MYBLOCK','XA',0,null,event,true,'',false,null,true);"
value="Add to cart"/>
When the user clicks on a dynamic link, the data context of the page does not exist anymore on the server.
It existed at the time of page construction and was then deleted.
The XTEND server stores in the HTML page (see <span id="xtdctx"> tag) the data context necessary to the process after selections and actions of dynamic links.
One of the roles of the JavaScript xtdDoDlk function is to find the data context associated to the dynamic link in order to send it again to the server.
For example:
The user wants to display the object (item/product) which has been clicked on in the detail page for a list/detail link. For the XTEND server, this operation consists in:
Storing the context in the HTML page ensures that XTEND functions correctly whilst using the "Back" button of the browser.
To call a dynamic link by JavaScript program (not managed by XTEND), use the following function:
//aElmt is the DOM element which has been clicked
//aDlk is the code of the dynamic link to call
//aParams is optional and contains the setups of the url (query string)
function xtdCallDlk(aElmt,aDlk,aParams){}
This function can be used only if the dynamic link has no reference to XTEND fields in the selection criteria or action setups.
Only "Web field' criteria or setups are taken into account.
In some case, the developer might have to intercept the click in order to process controls.
Declare a JavaScript function with the name xtdDoMyDlk so that the library (XtendLib.js) calls it by passing the contextual object on to aDomOut (CXtdDomOut class) which is used to access all information on the dynamic link.
This function returns "false" in order to interrupt the process.
function xtdDoMyDlk(aDomOut)
{
if (aDomOut.isDlk("MyDynLink"))
{
// The user has clicked on MyDynLink
return confirm("Confirm action");
}
return true;
}
The user can also intercept the process just before the form is sent to the server (submit) by creating a JavaScript function xDoMySubmit in the page:
function xDoMySubmit(aDlk,aDomOut){
// Returns false to stop the process
return true;
}
aDomOut class setup which gives access to the context of the dynamic link.
// Returns the value of user variable aKey
aDomOut.getUserVar(aKey);
// Returns the dynamic link code which the user has clicked on
aDomOut.getDynLinkId();
// Returns the index of the line (0 to N) if the user has clicked
// on a link in the table section'
aDomOut.getCurLineIdx();
// Returns True if the user has clicked on aArg link
// aArg is either a link table or a string
aDomOut.isDlk(aArg);
if (aDomOut.isDlk("DLK1","DLK2")){
// Code if the user has clicked on "DLK1" or "DLK2"
}
// Returns the list of WWeb parameters (Class CXtdDlkWebParamsOut)
aDomOut.getWebParameters();
// to know the value of the Web parameter aName
// aldx is the index of the value if the value is multiple
aDomOut.getWebParameters().getParamValue(aName,aIdx)
// Returns an Array containing the values of the Web parameter aName
aDomOut.getWebParameters().getParamValues(aName)
// Returns the value of a selection criteria or an action setup
// aFieldName is the name of the XTEND field used for mapping
aDomOut.getDlkParamValues(aFieldName);
// Ditto getDlkParamValues - aParamId is the ID of the parameter in the mapping
// - For selection criteria, the ID is SEL + criteria rank (1-N)
// - This is more accurate than getDlkParamValues as the ID contrary to the name of the XTEND field
aDomOut.getDlkParamValuesById(aParamId);
When an action setup is declared as "Mandatory web field", the library automatically controls:
To add additional control on web setups, add the following xtdWebParamCheckValue function in the HTML page.
This function is called for each web setup of the action associated with the dynamic link and returns "true" in order to validate the entry.
See the example in form entry of ASMAPLE site.
Setups:
function xtdWebParamCheckValue(aWebParamOut,aInputFieldName,
aInputFieldIndex,aInputFieldValue){
// Example: Control of email format on MAICOD field
if (aInputFieldName=="MAICOD"){
var wEmail=xtdCheckEmail(aInputFieldValue);
if (wEmail && wEmail!=aInputFieldValue){
//Format OK
//The value is updated with the format calculated by xtdCheckEmail
aWebParamOut.setValue(aInputFieldIndex,wEmail);
}
//True to validate the entry - False to make it invalid
return wEmail!=null;
}
}
// Returns True if the parameter is mandatory
aWebParamOut.isMandatory();
// Returns the Index of the field in the HTML form
// -> There can be several fields with the same name in the form (table)
aWebParamOut.getIndex();
// Returns DOM element
aWebParamOut.getElement(aIdx)
//aValue is an Array
aWebParamOut.setValues(aValue);
//aIdx is the index (0 - N) of the value
aWebParamOut.setValue(aIdx,aValue);
// Returns te value of another Web parameter
// -> useful i the control of a parameter value depends from other parameters
aWebParamOut.getParamValue(aName,aIdx);
// Returns the value in an Array
aWebParamOut.getValues();
// Returns aldx as index value
aWebParamOut.getValue(aIdx);
// Returns 0 as index value
aWebParamOut.getFirstValue();
// Returns name attribute
aWebParamOut.getName();
// Returns the type of parameter defined in XTEND dictionary
aWebParamOut.isInteger();
aWebParamOut.isX3Menu();
aWebParamOut.isDecimal();
aWebParamOut.isCurrency();
aWebParamOut.isDate();
aWebParamOut.isString();
aWebParamOut.isNumeric();
// Returns the type of element of the parameter DOM
aWebParamOut.isHidden(aIdx);
aWebParamOut.isInputText(aIdx);
aWebParamOut.isCheckBox(aIdx);
aWebParamOut.isRadio(aIdx);
aWebParamOut.isTextArea(aIdx);
aWebParamOut.isSelect(aIdx);
If the xtdWebParamCheck function is displayed in the page, the XTEND library calls this function before carrying out the setup control.
This function returns "true" to control the value and false to block the control.
It is particularly useful in the picking lists with line selection by a check box. It is used to filter lines in order to process to the control only on lines that are checked.
See the example in form entry of ASMAPLE site.
Setups:
var gNbChecked=0;
// Returns true if the web setup aInputFieldName/aInputFieldIndex must be controlled
function xtdWebParamCheck(aWebParamsOut,aInputFieldName,aInputFieldIndex){
/*
Example for a picking list with checkboxes (ASELECTED) to select lines.
here is no control on the AQUANTITY field if the line is not selected
*/
if (aInputFieldName=="AQUANTITY"){
// gNbChecked is a counter of the selected lines
// it enables the user to block the action if no line is selected
if (aInputFieldIndex==0) gNbChecked=0;
// Line selected if ASELECTED value is equal to 1
if (aWebParamsOut.getParamValue("ASELECTED",aInputFieldIndex)=="1"){
gNbChecked++;
return true;
}
return false;
}
return true;
}
Checkboxes are not returned in the HTML form if they are not checked.
This behaviour is not compatible with the XTEND engine which bases itself on the field index in the HTML form in order to associate data entered in the same grid line.
XTEND replaces unchecked CheckBoxes by an "input hidden" field bearing the same name just before sending the form to the server (xtdProcessCheckBoxes) so that CheckBoxes can still be returned even if they are not checked in the library.
The value used to valuate unchecked CheckBoxes is given by the global variable gXtdCBUnSelelectedValue which is empty by default (var gXtdCBUnSelelectedValue="").
To modify its value:
<script>
// Page onLoad event
function xBodyOnLoad()
{
// Set '0' value for unselected checkboxes
xtdSetUnSelelectedValue('0');
// Page initialization code
}
</script>
<body onLoad="xBodyOnLoad();">
<form>
//Html code
</form>
</body>
Upon parsing, XTEND detect all CheckBoxes that have an adx token and constitute a list which is sent to the customer in the data context of the page. CheckBoxes of this list are taken into account by the xtdProcessCheckBoxes function.
The XTEND server sends the information on "Regional Settings" that correspond to the current language to the browser in the data context of the page.
To access these information:
var wRegSettings=gXtdDOMFactory.getXtdDomIn().getRegionalSettings();
// Decimal separator
wRegSettings.getDecimalSep();
// Thousand separator
wRegSettings.getThousandSep();
// Date order - MDY=0 - DMY=1 - YMD=2
wRegSettings.getDateOrder();
// Pivot date to calculate X3 dates
wRegSettings.getDatePivot();
The following functions are used to add/delete variables and user criteria.
xtdAjax* functions update variables on the server via an Ajax request, without submitting the HTML form.
Other functions (except xtdGetUserVar) submit the HTML form.
// ---------------------------------------------------------------
function xtdRemoveUserVar(aId);
function xtdSetUserVar(aId,aValue);
function xtdGetUserVar(aId);
function xtdRemoveUserCrit(aId);
// ---------------------------------------------------------------
function xtdAjaxRemoveUserVar(aId);
function xtdAjaxRemoveAllUserVar();
function xtdAjaxSetUserVar(aId,aValue);
function xtdAjaxRemoveUserCrit(aId);
function xtdAjaxRemoveAllUserCrit();
function xtdAjaxSetUserCrit(aId,aValue);
function xtdRemoveAllUserCrit();
The following function displays a message calculated by the XTEND server.
The message is returned in the current language of the site.
Setups:
function xtdAlert(aId,aP1,aP2,aP3,aP4);
// The following example displays
// 'You are connected to the application with DIS001 use code'
xtdAlert("ASESSLOGIN2","DIS001");
The following class give access to the call context of the page in order to know the result of an action:
var wCallCtx==gXtdDOMFactory.getXtdDomIn().getCallingCtx();
// ---------------------------------------------------------------
// CLASS CXtdCallingCtx
// ---------------------------------------------------------------
// Dynamic link used to display the current page
wCallCtx.getDynLink();
// True si la page est le résultat d'une action
wCallCtx.hasAction();
// Action code
wCallCtx.getAction();
// True if the action occurred accurately - False it there is an error
wCallCtx.getActionResult();