Sybernet / Supplied Procedures Reference
Release 3.00
Mar 03, 2005
backwards forwards

HTTP.SP_HTML_HREF

sp_html_href creates an anchor tag and is specifically designed to make calling stored procedures and passing parameters to those procedures as easy as possible.

To add the ability to create a directory of hyper-text links, we've added some parameters to do this. In particular, DESCRIPTION will cause the anchor and description to be separated by paragraph tags.

All of the parameters are optional (which doesn't make a lot of sense, but it is consistent with HTML) and they are all varchars.

Syntax

procedure sp_html_href
(
    @PROCNAME                      VARCHAR(92)
,   @SEARCH                        VARCHAR(255)
,   @HREF                          VARCHAR(255)
,   @CHECKED                       VARCHAR(30)
,   @TARGET                        VARCHAR(30)
,   @anchorText                    VARCHAR(255)
,   @onMouseOver                   VARCHAR(255)
,   @onMouseOut                    VARCHAR(255)
,   @onClick                       VARCHAR(255)
,   @DESCRIPTION                   VARCHAR(255)
,   @STATUS                        VARCHAR(255)
,   @IMAGE                         VARCHAR(255)
,   @NAME                          VARCHAR(255)
,   @BORDER                        VARCHAR(255)
)   ;

Parameters

Parameter Description
procname
 
PROCNAME is the name of the stored procedure to invoke. PROCNAME corresponds to the direct argument in a URL request.

If not NULL, PROCNAME is appended to the name of the Sybernet CGI.
search
 
SEARCH represents the parameters to PROCNAME. sp_html_href will automatically URL Encode this string so you no longer have to worry about special characters when invoking a procedure.

Be aware that if you are passing multiple parameters to a procedure that the entire length of this string does not exceed 255 characters. If it does, you will need to construct this argument the old fashion way.

SEARCH corresponds to the Search argument in a URL request.
href
 
HREF allows you to specify the URL yourself. This would be used when you need to point this link to something other than a stored procedure. If specified, PROCNAME and SEARCH are ignored.
checked
 
If DESCRIPTION is not NULL, the value in CHECKED is compared to the value in SEARCH. If equal, the color of the anchorText will be red; otherwise, it will be white.
target
 
TARGET optionally specifies the windowName to be used for output when this link it clicked. If not specified, output returns to the same window.
anchortext
 
anchorText is the text to display at the anchor. If not specified, the value of SEARCH is used instead.
onmouseover
 
A mouseOver event occurs once each time the mouse pointer moves over an object from outside of that object.
onmouseout
 
A mouseOut event occurs each time the mouse pointer leaves an object.
onclick
 
A click event occurs when a link is clicked. The onClick event handler executes JavaScript code when a click event occurs.
description
 
If specified, DESCRIPTION is displayed after the anchor object. It will also separate that anchor with a <P> tag. In addition, a non-NULL value of DESCRIPTION determines the color of the anchorText. The CHECKED option determines what that color will be.
status
 
The value of STATUS is written to the status line when a MouseOver event occurs on this link.
image
 
If specified, IMAGE represents the name of an image in the images directory and this image is used in lieu of anchorText.
name
 
NAME represents the name of your image. This is optional unless you need to refer to that image name in JavaScript.
border
 
BORDER defines the size of the border that bounds your image. When 0, no border occurs.

Example 1

The first example is a simple anchor object that calls the main menu screen:

exec http.dbo.sp_html_href

    @PROCNAME   = 'sp_html_login'
,   @anchorText = 'Return to the Sybernet Main Menu screen'
,   @STATUS     = 'Click here to return to the main menu'
)    ;

Example 2

The next example constructs a hyper-text link that will invoke the procedure sp_html_template with a single (unnamed) parameter of "Order Pizza." That parameter is received by this procedure in the variable SEARCH, not to be confused with the SEARCH parameter that we set when we call sp_html_href.

exec http.dbo.sp_html_href

    @PROCNAME    = 'sp_html_template'
,   @SEARCH      = 'Order Pizza'
,   @CHECKED     = @SEARCH
,   @DESCRIPTION = 'Click here to order your pizza on the world wide web.'
It is also worth noting that the anchorText will default to the value for SEARCH and STATUS will default to DESCRIPTION since neither of these were specified.

Example 3

Since the name of the Sybernet CGI is automatically included when PROCNAME is not NULL, you wouldn't use this procedure to create anchor tags that point to anything other than a Sybase stored procedure; however, JavaScript is quite powerful, and this can be accomplished by the following example:

exec http.dbo.sp_html_href

    @PROCNAME   = NULL
,   @anchorText = 'Sybernet Home Page'
,   @onClick    = 'this.href="http://Sybernet.sri.com/"'

Example 4

Normally, this trick is reserved for those cases where the href needs to be determined dynamcially. Or it might be used to open a second window:

exec http.dbo.sp_html_href

    @PROCNAME   = NULL
,   @anchorText = 'Open Another Window'
,   @onClick    = 'window.open(","Sybernet","width=600,height=160");this.href="http://Sybernet.sri.com/"'
,   @TARGET     = 'Sybernet'

See Also

SP_HTML_INPUT
SP_HTML_FORM
SP_HTML_FRAME
SP_HTML_MENUBAR
SP_HTML_PREFERENCES


Sybernet is a trademark of SRI International.
Copyright © 1996-2008 SRI International. All Rights Reserved.
Denis D. Workman / http://Sybernet.sri.com/