Integrating Screen Data with HTML or Co-Server Applications
Page Links TEDECLARE SCREENMAP, TEGETSCREEN, TEPUTSCREEN, TEDECLARE SCREENCHANGE, TEDATA, TEAREA, TESHOW, TEFIELD, TEFORM,
Examples TEDECLARE SCREENMAP, TEDECLARE SCREENCHANGE, TEAREA-Simple Clickable, TEAREA-Clickable javaScript, TESHOW, TEFORM (simple), TEFORM (selectable),

Host Screen Data Definition and Generation Tags

This page describes the SurferScript tags used to define screen maps and how to include screen data in your HTML output stream. Note that with HTML clients, except when the <TENOTEXT> tag is used, every part of your SurferScript template is output to the HTML page except for SurferScript tags, which may or may not result in output.

HTML Clients: Retaining the Same Format

A key to displaying screens as they appear in a real terminal device is the use of the HTML "PRE" (preformatted) tag. All ScreenSurfer default emulation areas are inside a PRE block. An important point to understand is that inside a PRE block, all of the carriage returns are used to break to the next line, unlike normal HTML which requires a <BR> tag or another tag that will result in a line break such as the <P> tag. Because of this, you should understand the TENOTEXT tag, described in the SurferScript Introduction.

In ScreenSurfer V3, the HTML pages created using the Visual Surfer Screen Object wizard are not formatted in a PRE tag, as HTML tables are used instead to maintain a correct visual layout of the fields on the screen.

ScreenMaps

Introduced in ScreenSurfer Version 2.5 (and some preview releases) is the ScreenMap, which is a key element to developing high performance, easy-to-maintain ScreenSurfer applications. The ScreenMap declaration, editable in the DevCenter's Visual Surfer Screen Object Wizard, enables a clear mapping of the dynamic fields on a screen to provide a single definition of screen data.

While the syntax for defining a Screenmap is included here, the recommended method of managing ScreenMaps is with the Screen Object Wizard. In Version 3 of ScreenSurfer, the "create" and "manage" Screenmap function is in the Screen Object Wizard which is within the new Visual Surfer functionality (see the Visual Surfer documentation within the DevCenter tab for more information).

Unlike the non-Visual Surfer wizards in the DevCenter, the screen object wizard enables both initial screenmap definition and ongoing maintenance/editing of a screenmap.

This DevCenter wizard provides management of one or more screen maps per screen (the screen must be identified with a TESECTION before a screen map can be created for it; the wizard will only work with screens that have already been identified in the Identify and Navigate Wizard.


TEDECLARE SCREENMAP Defines a row of text and numeric variables mapped to screen locations

<TEDECLARE SCREENMAP
   [MapName=]{name} 
   [Formatted=yes|no]
   [ForSection=SectionName]
   {[name=]VarName [type=]Type [row=]Row [column=]Column [length=]Length
                   [[actions=]read|write|readwrite]}[,]
   [VarDecl2...][,]
   [...][,]
   [VarDeclN]>

Defines a row of SurferScript variables which may be "loaded" from the active screen buffer using the <TEGETSCREEN MapName> tag and "put" to the screen using the <TEPUTSCREEN MapName> tag.

MapName is the name of the ScreenMap, referenced in the <TEACTION WEBTOSCREENMAP>, <TEPUTSCREEN>, <TEGETSCREEN> and <TERESULT> tags.

Formatted is an optional parameter with the default of "yes"--if set to "no", the target screen is assumed to be unformatted, and fields will be read and written with no expectation of field attributes (the field data "put" and "get" actions will operate on the exact data area defined, without clearing to any field delimiter).

ForSection is an optional parameter associating this screen map with a specific screen section (defined using TESECTION name when Screen_r_c is "text"). This association enables the DevCenter to work with ScreenSurfer to edit the ScreenMap definition following the initial definition; using this facility, the visual editing of the screenmap can be used throughout the development lifecycle.

Variable Definition Each variable, as with the TEDECLARE ROW tag, is defined using standard variable definitions (name type size) except that instead of the size attribute being in the list, the row column size is used, so that not only the length of a text field is defined; so is its location on the screen.

Note that in the TERESULT tag, the SCREENMAP may be used in an identical fashion to the ROW defined using TEDECLARE ROW. All variables defined as READ, READWRITE or not having any screen actions will be sent to a co-server requestor in a TERESULT which specifies the defined screenmap.

Another use of the ScreenMap is in processing web input; the <TEACTION WEBTOSCREENMAP TargetScreenMap> tag will copy all Web. variables with a matching name to the target ScreenMap. #sampletsc1

TEDECLARE SCREENMAP Example 1
<tedeclare ScreenMap MapName="EmpDetails" ForSection="screens.empupd"
    FirstName text  4 16 12 readwrite,
    LastName  text  4 37 16 readwrite,
    SSN1      text  4 67  3 readwrite,
    SSN2      text  4 72  2 readwrite,
    SSN3      text  4 76  4 readwrite,
    DeptCode  text  6 15  3 readwrite,
    StartDate text  6 29 10 readwrite,
    DeptDesc  text  6 19 15 read,
    JobClass  text  8 20  2 readwrite,
    JobTitle  text  8 38 20 readwrite,
    Salary    text  8 70 10 readwrite,
    AddrLine1 text 13 18 30 readwrite,
    AddrLine2 text 14 18 30 readwrite,
    AddrLine3 text 15 18 30 readwrite,
    AddrCity  text 16 18 30 readwrite,
    AddrState text 17 18  2 readwrite>
...
<TEGetscreen screenmap="EmpDetails">
<TEResult type="row" screenmap="EmpDetails">
Defines a screen map named "EmpDetails" which can be used for both reading and writing values--last two lines show how to read all the fields from the screen and send them to a co-server in two SurferScript lines.

TEDECLARE ScreenMap Example 2
<TEputsection control.connect>
<TEaction goto screens.mainmenu>
<TEaction enter "3[enter]" skipcode>
<TEaction enter web.EmpNumber+"[enter]" skipcode>
<TEaction WebtoScreenMap EmpDetails>
<TEPutScreen screenmap="EmpDetails">
<TEAction enter "[enter]" skipcode>
Uses the Screenmap defined in first example to update employee details. This example could be for both HTML and co-server environments. The input (web. variables) is named matching the names in the Screenmap.

The first three lines of the example use standard ScreenSurfer scripts found in the \screensurfer\hostserver\toysample directory.




TEGETSCREEN Populate screenmap values with the current host screen values

<TEGETSCREEN
   [ScreenMap=]{name}>

Automatically populates the screenmap values with the current host screen values based on row, column placement from the host screen with the specified length. This replaces the need to code a series of <TESET> tags to populate each defined field in the screenmap.

ScreenMap is the name of the ScreenMap, referenced in the <TEDECLARE SCREENMAP> tag.

TEPUTSCREEN Populate host screen values with current screenmap values

<TEPUTSCREEN
   [ScreenMap=]{name}>

The <TEPUTSCREEN> tag does the reverse of the <TEGETSCREEN> tag. This tag automatically populates host screen values based on row, column placement on the host screen with the specified length from the <TEDECLARE SCREENMAP> screenmap definition. The <TEPUTSECTION> tag replaces the need to code a series of <TEACTION PUTFIELD> or <TEACTION PUTDATA> tags to populate the host screen values.

ScreenMap is the name of the ScreenMap, referenced in the <TEDECLARE SCREENMAP> tag.

TEDECLARE SCREENCHANGE Defines a screen transition and the needed aid key(s) to cause the transition

<TEDECLARE SCREENCHANGE
         {[Fromscreen=]FromScreen}
         {[Toscreen=]ToScreen}
         {[Enterkeys=]EnterKeys}
         [Navpath=NO|yes] [[Testkeys=]testkeys]>

The <TEDECLARE SCREENCHANGE> tag defines the screen transition and the needed aid key(s) to cause the transition. To utilize the SCREENCHANGE definition and cause the screen transition, you must code a <TEENTER> tag with the Fromscreen and Toscreen parameters.

FromScreen is the name of the screen recognition section for the "From" screen. If the screen recognition section is called VSRecog, then you can just use the template name.

ToScreen is the name of the screen recognition section for the "To" screen. If the screen recognition section is called VSRecog, then you can just use the template name.

EnterKeys are all keystrokes that are a fixed portion of the transition--this does NOT include variable data, such as the input to a customer search criteria screen. It always includes the final AID key.

Navpath if YES, this tag feeds the PATHTO metabase, which enables the use of this definition to perform TEACTION GOTO navigation. The Visual Surfer Identify and Navigate Wizard will set this to YES if all entries made in the transition are retained as "fixed" (no variable entries made during the transition).

Testkeys are the keystrokes, as entered. This enables the navigation to this screen in test and the "screen change alerts" mode, using the original test data. This is to be used in development for quick navigation to the target screen during testing. For example, if there is a test customer number, the Visual Surfer environment will be able to navigate directly to the actual results screen in one click of the mouse.

TEDECLARE SCREENCHANGE
<TEDeclare ScreenChange
  FromScreen="menu.VSRecog" ToScreen="addemp.VSRecog"
  TestKeys="[put](f_1694_2,'1')[Enter]"
  EnterKeys="[put](F_1694_2,'1')[Enter]"
  NavPath="YES">
<TEEnter FromScreen="menu.VSRecog" ToScreen="addemp.VSRecog">
Defines a screenchange going from the the Toy Mainframe Menu to the Add Employee screen. The TestKeys and the EnterKeys define what information to enter into the Menu screen to navigate to the Add Employee screen. Setting NavPath to YES turns on the PATHTO support to use the TEACTION GOTO to auto-navigate to the Add Employee screen. A <TEENTER> must be used to initiate the screen transition.

TEDATA Define a portion of the current screen for use in generating HTML

<TEDATA  Row Column Length  [AS {INPUT | OUTPUT | USEREXT}]>

Will send the current host screen area defined using row, column and length (which each may be any valid numeric expression) to the current browser page. AS INPUT will send a full HTML INPUT tag including the correct HTML form field name to return any data the user enters back to the current screen in the specified location.

Only use the AS INPUT clause for true 3270 unprotected (entry) areas, as using it in a protected area will cause a runtime error and error text to be displayed to the user.

AS OUTPUT is the default, which simply sends the specified data as unformatted text.

AS "USEREXT" represents any tag provided by user extension DLL's, which can format the data in a customized manner. The keywords supported (in place of the "USEREXT" token) are defined by the user extension DLL's. The SAMPLE.DLL user extension provides the AS BOLD extension to this tag.


TEAREA Define an area of current screen for use in generating HTML

<TEAREA topLeftRow topLeftColumn bottomRightRow bottomRightColumn
   [AS USEREXT optional parms]
   [AS CLICKABLE {TranID | JavaScript="JavaFunctionName"}]
   [READONLY]
   [WRAPINPUT]
   [SELECTABLE]
   [BREAKONBLANK]>

Sends the specified rectangle from the current host screen to the active HTML page-- note that the data will need to be pre-pended with a <PRE> tag and followed with a </PRE> tag if the formatting of the fixed-font 3270 screen is to be preserved. Any unprotected (entry) fields found in the area will be sent as HTML INPUT tags.

AS "USEREXT" supports user extension DLL's which can format the data in a customized manner. The keywords supported (in place of the USEREXT token) are defined by the user extension DLL's. The SAMPLE.DLL user extension provides the AS READONLY (no entry fields are created) and AS PLAIN (no <PRE> tags are generated) extensions to this tag.

AS CLICKABLE supports the generation of unique links surrounding each protected field in the TEAREA-- this will create a URL that can be captured with a <TESECTION WHEN TranPath...> section (a transaction section).  The URL will include values for C_POS (cursor position), SessionKey and ScreenID, all of which can be used to interact with the current host screen session.  Note that the links will target an alternate browser window named "3270tranid".

Note that when using the AS CLICKABLE, you can also enter the keyword JavaScript=, followed by the name of a Javascript function that will need to be defined in some manner in the HTML page currently being generated.

The called Javascript function should have a single parameter, which will be the cursor position of the field that is being given a link.

[READONLY] Prevents the generation of any INPUT form objects should there be any unprotected fields within the specified area. Use this attribute any time the user should be able to see the data but not be able to change it.

[WRAPINPUT] Will cause input fields to be broken and contintued on the next line. By default, if an unprotected field on the 3270 display runs past the end of one line and continues on the next, the TEAREA tag will only generate a single input field in the current form, making the "size" of the field the visual size it takes on the first line, and the "maxlength" attribute equal to the total size of the field on the screen. Use WRAPINPUT to override this default behavior and break the field up into multiple HTML INPUT tags.

[SELECTABLE] When Screen.SelectClicks is set to "off" or 0, you can make individual areas of a 3270 screen support the SELECTABLE attribute with this setting. Selectable fields are used commonly in the health industry to enable the selection and triggering of events with a light pen (or in the case of a PC, with the mouse). When a protected field has the selectable attribute and SELECTABLE is used in the TEAREA (or Screen.SelectClicks=1), the TEAREA tag will generate special links that manage the emulation of the light pen when the user at the browser clicks on fields with the mouse.

[BREAKONBLANK] When AS CLICKABLE is specified, or SELECTABLE, use BREAKONBLANK to treat each "word" on the screen as an individual HTML field. This allows the cursor location to be set to individual words on the screen rather than individual fields. In some applications, the cursor location is critical to individual areas within a large field-- when combined with the CLICKABLE support, you can zero-in on any word within a field using BREAKONBLANK.

TEAREA Simple Clickable Example
<TESECTION Inquiry
  WHEN Screen_1_2 is "Customer"
   AND Screen_1_15 is "Inquiry">
<HTML>
<HEAD>
 <TITLE>Customer Inquiry</TITLE>
</HEAD>
<BODY>
Here are the results of your inquiry:
click on any underlined fields to display help:<BR>
<TEMACRO TERMBODY>   
<TEFORM>
<PRE><TEAREA 2 1 20 80 AS CLICKABLE HELP></PRE>
<TESHOW AidButtons("pf3=Return to Main Menu pf4=Customer Menu","")>
</FORM>
</BODY>
</HTML>
</TESECTION>

The above will generate the screen from row 2 to row 20 (all columns). The screen is surrounded using the PRE (preformatted) tag, so that the original formatting of the host screen is preserved.

When the user clicks on a link, a transaction defined as follows will execute in the ScreenSurfer server:


<TESECTION MYHELP
   WHEN TRANPATH_1 IS "CLICK"
   and TRANPATH_2 IS "HELP">

TEAREA Clickable JavaScript Example
<SECTION WHATEVER>
<HTML><HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from old browsers
 AppHELP(C_Pos)
 {
   helpWindow=window.open ("/click/AppHELP?c_Pos="+C_Pos+
      "&ScreenID=<TEMACRO ScreenID>"+
	  "&SessionKey=<TEMACRO SessionKey>",
      "3270Help","toolbar=no,scrollbars=yes")
 }
//---End hiding from old browsers -->
</SCRIPT>
</HEAD>
<TEMACRO TERMBODY>
<TEFORM>
<PRE><TEAREA 2 1 20 80 AS CLICKABLE JavaScript="AppHelp"></PRE>
<TESHOW AidButtons("pf3=Return to Main Menu pf4=Customer Menu","")>
</FORM>
</BODY>
</HTML>
</TESECTION>

<TESECTION HELP
  WHEN TranPath_1 IS "CLICK"
  AND  TranPath_2 IS "AppHELP">
<HTML><TITLE>Some Help</TITLE>
<H1>You clicked on help</H1>
<p>Clicked on a field with offset=<TESHOW web.c_pos>
<p>Your SessionKey is "<TESHOW web.sessionkey>"
<p>The ScreenID is "<TESHOW web.screenid>"
<TEACTION GETSESSION>
<p>The ScreenID is "<TEMACRO screenid>"
<p>The SessionKey is "<TEMACRO sessionkey>"
<p>The cursor position is <TEMACRO CursorPos>"
<TEACTION ENTER "[home]HELP[enter]" SKIPSCAN>
<p>The Help IS:<BR><PRE><TEAREA 1 1 24 80></PRE>
<TEACTION ENTER "RESUME[enter]" SKIPSCAN>
<TEACTION RETURN>
</TESECTION>
The above example creates all unprotected fields as clickable areas on the HTML form. The user-written Javascript function "appHelp" is called with the 3270 cursor location corresponding to the field clicked-on. This opens a new browser window (to display help separately), and uses a transaction section to display the help from the host screen.



TESHOW Send any text expression to the current browser page
 
Syntax:  <TESHOW TextExpression>

You can use the TESHOW tag to display text in the current HTML stream.  Any text expression is valid (see the <TESET> tag for examples).

TESHOW Examples
<TESHOW "<!-- Only way to embed a true HTML comment">
...
<TESHOW "Sorry, you entered "+Web.UserID+" as your UserID,
            and the Host has rejected it saying:
            <BR><PRE>"+Screen(24,1,80)+"</PRE>">
The first example demonstrates the only way to embed true comments in the outbound HTML stream (unless they immediately follow a SCRIPT tag).

The second example shows a simple string concatenation to enable a mixing of static text, variable data and screen data in one output operation.




TEFIELD Call a DHTML Function to generate HTML for the specified field
 
Syntax: 
<TEFIELD
     [var=]VariableName
     [[dhtmlFunc=]JavaScript handler]
     [[length=]Length of field (maxlength)]
     [[attrs=]Customization properties]>
     [[formName=]Name the field should have in the HTML form]>
Parameters:

The TEField tag will "package" the active value for a ScreenSurfer surferscript variable into a call to a Javascript function, along with customization properties for the field.

This tag is principally used by the Visual Surfer Screen Object Wizard as part of the Visual Surfer HTML forms generation framework, but it can be called independently as long as the attributes are managed properly in the field's screenmap entry (or in the tag itself).

Javascript functions used to generate the DHTML are provided by Teamstudio, by Teamstudio business partners or customers. Additional functions may be registered in the userdefs.js file (\screensurfer\hostserver\docs\devtool) and may be authored in a .JS file, which should then be included in the call to global.header in the global module (edit in the Visual Surfer global settings wizard).



TEFORM Generate an HTML Form for use as a terminal emulation form
 
Syntax: 
<TEFORM
     [[name=]NameExpression]
     [[transaction=]TargetTransactionExpression]
     [[extra=]ExtraScriptExpression]
     [[selectable=]"yes" or "no"]>
Parameters:

The TEFORM tag will generate a <FORM> HTML tag while synchronizing and automating the <FORM tag with the active session. The TEFORM tag replaces the <TEMACRO TERMFORM> tag, which will not be enhanced any further.

Simple TEFORM Example
<TEFORM>
<pre>
<TEAREA 1 1 24 80>
</pre>
<TESHOW AidButtons("enter=Enter pf1=Help pf3=Exit","")>
</TEFORM>
The above example displays the current screen window in its entirety, with three buttons providing the Enter, PF1 and PF3 AID functions.

Selectable Fields TEFORM Example
<TEFORM Selectable="yes" Transaction="Patient/NewBed">
<pre>
<TEAREA 1 1 5 80>
<TEAREA 6 1 20 80 SELECTABLE>
<TEAREA 21 1 24 80>
</pre>
<TESHOW AidButtons("enter=Enter pf1=Help pf3=Exit","")>
</TEFORM>
The above example displays the center of the screen as a selectable area; any fields displayed by the host with the selectable attribute will be displayed as clickable links that will either "select", "de-select" or cause a cursor select AID action (depending on the type of selectable field).

Note that the target for this form is the user-defined transaction "Patient/Bed" instead of the standard internal URL of "emulator".

Top of Page