Online documentation - Websydian v6.5
|
Script Markers
Introduction Implementing Other
Uses Background
Script markers are special replacement markers that can
influence on the output generated by the page generator. The script
markers are identified by having a percentage '%' in the first
position of the replacement marker.
Currently we support the following script markers, described
below
The script marker %IFEQ is used to control if a part of the
template is to be shown or not based on a true condition by
validating the value of a field located in the WSYDETAILS or
WSYGRID variable of the page generator.
The information in the template is not sent to the browser if
the condition is not met and thereby there is no way the user can
obtain access to the information in the browser. This is different
from using a javascript in order to show hide information in the
page.
Syntax
/(%IFEQ-[DetailOrGridFieldImplementationName]=[Value])
. . . . .
/(%ENDIF)
- [DetailOrGridFieldImplementationName], holds the implementation
name of field that is to be validated. The field should be located
in the variable WSYDETAILS or WSYGRID
- [Value], holds the value that should be used for validating the
true condition.
Examples
Show hello world or not depending on field value
/(%IFEQ-ShowHelloWorld=Yes)<p>Hello
World</p>/(%ENDIF)
If the value of the field with implementation name
ShowHelloWorld is 'Yes' the paragraph Hello World will be
shown.
Checking for empty value
/(%IFEQ-Name=)<p>No name
available</p>/(%ENDIF)
If the field with implementation name 'Name' is empty the
paragraph 'No name available' is displayed.
Show view or update dialog depending on field value
/(%IFEQ-ViewOrUpdate=Update)
<form action="/(WSACTION)" name="WS5yddtF"
method="post" autocomplete="OFF" id="WS5yddtF">
<input type="HIDDEN"
name="WSYD_EVENT" value="WS5yddtF">
<input type="HIDDEN"
name="WSYD_SIGN" value="/(WSYD_SIGN)/(WS5yddtF)">
<input type="HIDDEN"
name="WSYD_SID" value="/(WSYDHIDDEN)/(WSYD_SID)">
<input type="HIDDEN"
name="WSCURPRS" value="/(WSYDHIDDEN)/(WSCURPRS)">
<table
class="input">
<tr>
<th>Your name please</th>
<td><input type="TEXT" name="WS5yc3pA" value="/(WS5yc3pA)"
maxlength="250" size="64"></td>
</tr>
<tr>
<th> </th>
<td><input type="button" value="Update"
name="WS5yddtF"></td>
</tr>
</table>
</form>
/(%ENDIF)
/(%IFEQ-ViewOrUpdate=View)
<table class="details">
<tr>
<th>Your name is</th>
<td>/(WS5yc3pA)"</td>
</tr>
</table>
/(%ENDIF)
If the value of the field ViewOrUpdate is set to 'Update' the
dialog with update your name is shown on the other hand if the
value of the field ViewOrUpdate is set to View the user is only
shown the information without being able to update.
Nesting IFEQ
/(%IFEQ-ViewOrUpdate=Update)
<form action="/(WSACTION)" name="WS5yddtF"
method="post" autocomplete="OFF" id="WS5yddtF">
<input type="HIDDEN"
name="WSYD_EVENT" value="WS5yddtF">
<input type="HIDDEN"
name="WSYD_SIGN" value="/(WSYD_SIGN)/(WS5yddtF)">
<input type="HIDDEN"
name="WSYD_SID" value="/(WSYDHIDDEN)/(WSYD_SID)">
<input type="HIDDEN"
name="WSCURPRS" value="/(WSYDHIDDEN)/(WSCURPRS)">
<table
class="input">
<tr>
<th>Full name</th>
<td><input type="TEXT" name="WS5yc3pA" value="/(WS5yc3pA)"
maxlength="250" size="64"></td>
</tr>
/(%IFEQ-AllowSocialSecurityNumber=Yes)
<tr>
<th>Social security number</th>
<td><input type="TEXT" name="WS5yc3kA" value="/(WS5yc3kA)"
maxlength="250" size="64"></td>
</tr>
/(%ENDIF)
<tr>
<th> </th>
<td><input type="button" value="Update"
name="WS5yddtF"></td>
</tr>
</table>
</form>
/(%ENDIF)
If the value of the field ViewOrUpdate is set to 'Update' and
the value of AllowSocialSecurityNumber is 'Yes' the user is allowed
to update both the field 'Full name' and the 'Social security
number'.
You are allowed to nest both IFEQ and IFNEQ just
make sure that you added the appropriate /(%ENDIF) script
marker.
The script marker %IFNEQ is used to control if a part of the
template is to be shown or not based on a false condition by
validating the value of a field located in the WSYDETAILS or
WSYGRID variable of the page generator.
The information in the template is not sent to the browser if
the condition is met and thereby there is no way the user can
obtain access to the information in the browser. This is different
from using a javascript in order to show hide information in the
page.
Syntax
/(%IFNEQ-[DetailOrGridFieldImplementationName]=[Value])
. . . . .
/(%ENDIF)
- [DetailOrGridFieldImplementationName], holds the implementation
name of field that is to be validated. The field should be located
in the variable WSYDETAILS or WSYGRID
- [Value], holds the value that should be used for validating the
false condition.
Examples
Show hello world or not depending on field value
/(%IFNEQ-ShowHelloWorld=No)<p>Hello
World</p>/(%ENDIF)
If the value of the field with implementation name
ShowHelloWorld is anything else than 'No' the paragraph Hello World
will be shown.
Checking for empty value
/(%IFNEQ-Name=)<p>Your name is
/(Name)</p>/(%ENDIF)
If the field with implemenation name Name is not empty the
paragraph 'Your name is xxx' is displayed.
Show view or update dialog depending on field value
/(%IFNEQ-ViewOrUpdate=View)
<form action="/(WSACTION)" name="WS5yddtF"
method="post" autocomplete="OFF" id="WS5yddtF">
<input type="HIDDEN"
name="WSYD_EVENT" value="WS5yddtF">
<input type="HIDDEN"
name="WSYD_SIGN" value="/(WSYD_SIGN)/(WS5yddtF)">
<input type="HIDDEN"
name="WSYD_SID" value="/(WSYDHIDDEN)/(WSYD_SID)">
<input type="HIDDEN"
name="WSCURPRS" value="/(WSYDHIDDEN)/(WSCURPRS)">
<table
class="input">
<tr>
<th>Your name please</th>
<td><input type="TEXT" name="WS5yc3pA" value="/(WS5yc3pA)"
maxlength="250" size="64"></td>
</tr>
<tr>
<th> </th>
<td><input type="button" value="Update"
name="WS5yddtF"></td>
</tr>
</table>
</form>
/(%ENDIF)
/(%IFEQ-ViewOrUpdate=View)
<table class="details">
<tr>
<th>Your name is</th>
<td>/(WS5yc3pA)"</td>
</tr>
</table>
/(%ENDIF)
If the value of the field ViewOrUpdate is set to anything else
than 'View' the dialog with update your name is shown on the other
hand if the value of the field ViewOrUpdate is set to View the user
is only shown the information without being able to update.
Nesting IFNEQ
/(%IFNEQ-ViewOrUpdate=View)
<form action="/(WSACTION)" name="WS5yddtF"
method="post" autocomplete="OFF" id="WS5yddtF">
<input type="HIDDEN"
name="WSYD_EVENT" value="WS5yddtF">
<input type="HIDDEN"
name="WSYD_SIGN" value="/(WSYD_SIGN)/(WS5yddtF)">
<input type="HIDDEN"
name="WSYD_SID" value="/(WSYDHIDDEN)/(WSYD_SID)">
<input type="HIDDEN"
name="WSCURPRS" value="/(WSYDHIDDEN)/(WSCURPRS)">
<table
class="input">
<tr>
<th>Full name</th>
<td><input type="TEXT" name="WS5yc3pA" value="/(WS5yc3pA)"
maxlength="250" size="64"></td>
</tr>
/(%IFNEQ-AllowSocialSecurityNumber=No)
<tr>
<th>Social security number</th>
<td><input type="TEXT" name="WS5yc3kA" value="/(WS5yc3kA)"
maxlength="250" size="64"></td>
</tr>
/(%ENDIF)
<tr>
<th> </th>
<td><input type="button" value="Update"
name="WS5yddtF"></td>
</tr>
</table>
</form>
/(%ENDIF)
If the value of the field ViewOrUpdate is set to anything else
thatn 'View' and the value of AllowSocialSecurityNumber is 'Yes'
the user is allowed to update both the field 'Full name' and the
'Social security number'.
You are allowed to nest both IFEQ and IFNEQ just make sure that
you added the appropriate /(%ENDIF) script marker.
The script marker /(%LEN-[Value]) is used to suppress the total
length of the preceding field. This is very useful in grid tables
where you would like to control the maximum length of a field to be
outputted.
Syntax
/(%LEN-[Value])/(ImplementationNameOfFieldToBeSuppressed)
- [Value], holds the value that should be used for validating the
true condition.
Examples
Basic usage
/(%LEN-64)/(FullName)
The value of the field with implementation name 'FullName' is
suppressed to 64 characters.
This script marker can be used to insert the content of a file
in the generated page.
The file to load will always be found in the folder that
contains the template used to generate the page.
Syntax
/(%EMBED-[filename])
- [filename] - The name of the file to insert.
Examples
/(%EMBED-Myfile)
This will find the file name MyFile in the folder containing the
template used by the PageeGenerator, the file will be opened
and the content will replace the script marker in the generated
page.
The most common case for this marker is to insert the content of
a JavaScript file in the generated page. In this way, you avoid the
caching of the js file by the browser - and you can update the
content of the file without the user having to clear his browser
cache.