JSPMaker Custom Tags Example
JSPMaker provides more flexibility to customize your generated codes
by supporting tag customization. You can override an existing replacement
tag or create your own replacement tags to suit for different needs.
To do this you need to write your own VBScript module and save it to
the
User Code File (usually C:\JSPMaker\src\usercode.txt) for the changes
to take effect.
Please see below for examples of tags customization.
Example 1. Override an existing Replacement
Tag
Task:
Assume you have a "Users" Table with a "Country" Field
which has been set to a combo box. You want to skip generating the "Please
Select" option for this field.
Steps:
Create the following module in the User Code File to override the "FIELDEDIT_SELECT"
tag.
Function FIELDEDIT_SELECT(str)
Dim wrkstr
If Table.TblName = "Users" And Field.FldName = "Country"
Then
wrkstr = Replace(str,"<OPTION value=''><--##@PleaseSelect##--></OPTION>","")
Else
wrkstr = str
End If
FIELDEDIT_SELECT = wrkstr
End Function
Example 2: Create your own Replacement Tags
Task:
Assume you have a "Users" Table and you want to create a help
page for this table and link it from the list page.
Steps:
1. Create the help page file (say userhelp.htm) using standard Html Editor.
2. Override the "tablecaption" tag to add a reference to a new
tag (say "userhelp") next to the table caption.
Function
tablecaption(str)
Dim wrkstr
If Table.TblName = "Users" Then
wrkstr = str & " <--##userhelp##-->"
Else
wrkstr = str
End If
tablecaption = wrkstr
End Function
3. Create the following module in the
User Code File to process the new tag ("userhelp").
Function
userhelp(str)
If Ctrl.CtrlID = "list" Then
userhelp = "<a href='userhelp.htm'>Help</a>"
Else
userhelp = ""
End If
End Function
|