Sybernet / Supplied Procedures Reference
Release 3.00
Nov 25, 2006
backwards forwards

HTTP.SP_HTML_INPUT

SP_HTML_INPUT creates an input field. All of the input fields that you are familar with may be created with this procedure. You can also create a TEXTAREA and SELECT list with this procedure.

It is not required that you use this procedure to create your form screens, but there are several reasons why you may want to. SP_HTML_INPUT supports pre-defined datatypes (such as int, smallint, and tinyint) which are validated on the client before these fields are submitted to your procedure. Input values are mapped so that they appear correctly on your screen. Have you ever wondered how to specify a value containing double quotes? SP_HTML_INPUT will do this for you automatically. The value passed to SELECT and TEXTAREA can be a select statement which is evaluated in real-time.

Perhaps the most compelling reason, however, is that SP_HTML_INPUT will make your input fields look and behave the same among NS4, NS7, and MSIE. NS4 correctly renders text fields with a monospace font-family. NS7 doesn't. NS7 does when when you create this field with SP_HTML_INPUT. MSIE buttons are absolutely pathetic, but look less so when created by SP_HTML_INPUT.

SP_HTML_INPUT will also raise an exception if you attempt to create an input field that it does not know about. HTML ignores invalid types and gives you a text field instead. If you misspell onFocus in an HTML form, HTML will ignore it. If you misspell onFocus when you call SP_HTML_INPUT, Oracle will complain.

All of the parameters are optional just like in regular HTML. All parameters are varchars unless otherwise indicated.

Syntax

Procedure SP_HTML_INPUT
(
    TYPE                IN  VARCHAR2	    := 'TEXT'       -- text|password|checkbox|radio|submit|reset|file|hidden|image|textarea|select
,   NAME                IN  VARCHAR2        := NULL         -- {CDATA}
,   VALUE               IN  VARCHAR2        := NULL         -- {CDATA}
,   ALERT               IN  VARCHAR2        := NULL         -- {CDATA}
,   CONFIRM             IN  VARCHAR2        := NULL         -- {CDATA}
,   ONBLUR              IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONCLICK             IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONCHANGE            IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONFOCUS             IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONSELECT            IN  VARCHAR2        := NULL         -- {SCRIPT}
,   TAGSIZE             IN  VARCHAR2        := NULL         -- {NUMBER}
,   MAXLENGTH           IN  VARCHAR2        := NULL         -- {NUMBER}
,   CHECKED             IN  VARCHAR2        := NULL         -- {CDATA}
,   MINVALUE            IN  VARCHAR2        := NULL         -- {NUMBER}
,   MAXVALUE            IN  VARCHAR2        := NULL         -- {NUMBER}
,   ROWS                IN  VARCHAR2        := NULL         -- {NUMBER}
,   COLS                IN  VARCHAR2        := NULL         -- {NUMBER}
,   WRAP                IN  VARCHAR2        := NULL         -- <deprecated>
,   DELIMETER           IN  VARCHAR2        := ','          -- {CHARACTER}
,   STYLE               IN  VARCHAR2        := '107'        -- {STYLESHEET}|{NUMBER}
,   ALIGN               IN  VARCHAR2        := NULL         -- TRUE|FALSE|LEFT|RIGHT
,   SCALE               IN  VARCHAR2        := NULL         -- {NUMBER}
,   COMMA               IN  VARCHAR2        := NULL         -- TRUE|FALSE
,   DEBUG               IN  BOOLEAN         := FALSE        -- TRUE|FALSE
,   PROCNAME            IN  VARCHAR2        := NULL         -- [OWNER.][OBJECT_NAME]
,   BUTTON              IN  VARCHAR2        := NULL         -- {CDATA}
,   DISABLED            IN  BOOLEAN         := NULL         -- TRUE|FALSE
,   READONLY            IN  BOOLEAN         := NULL         -- TRUE|FALSE
,   TABINDEX            IN  VARCHAR2        := NULL         -- {NUMBER}
,   NULLVALUE           IN  VARCHAR2        := NULL         -- <deprecated>
,   PROLOGUE            IN  VARCHAR2        := NULL         -- [{CDATA}=]{CDATA}
,   EPILOGUE            IN  VARCHAR2        := NULL         -- [{CDATA}=]{CDATA}
,   MULTIPLE            IN  BOOLEAN         := NULL         -- TRUE|FALSE
,   SORTED              IN  BOOLEAN         := TRUE         -- TRUE|FALSE
,   NLS_DATE_FORMAT     IN  VARCHAR2        := NULL         -- {CDATA}
,   EVALUATE            IN  BOOLEAN         := TRUE         -- TRUE|FALSE

,   ALT                 IN  VARCHAR2        := NULL         -- {CDATA}
,   ACCESSKEY           IN  VARCHAR2        := NULL         -- {CHARACTER}
,   ACCEPT              IN  VARCHAR2        := NULL         -- {CONTENTTYPES}
    --
    -- coreattrs
    --
,   ID                  IN  VARCHAR2        := NULL         -- {ID}
,   CLASS               IN  VARCHAR2        := NULL         -- {CDATA}
,   DECORATION          IN  VARCHAR2        := NULL         -- {STYLESHEET}
,   TITLE               IN  VARCHAR2        := NULL         -- {TEXT}
    --
    -- il8n
    --
,   LANG                IN  VARCHAR2        := NULL         -- {LANGUAGECODE}
,   DIR                 IN  VARCHAR2        := NULL         -- (ltr|rtl)
    --
    -- events
    --
,   ONDBLCLICK          IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONMOUSEDOWN         IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONMOUSEUP           IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONMOUSEOVER         IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONMOUSEMOVE         IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONMOUSEOUT          IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONKEYPRESS          IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONKEYDOWN           IN  VARCHAR2        := NULL         -- {SCRIPT}
,   ONKEYUP             IN  VARCHAR2        := NULL         -- {SCRIPT}
)   ;

Parameters

Parameter Description
type
 
TYPE is the type of input field you want to build. You can pass all of the standard HTML types (including SELECT and TEXTAREA). In addition, there are predefined types which correspond to similarly named datatypes in Sybase and Oracle. A description of each is documented below.
name
 
NAME is the name of this field. Remember that a recent change to Sybernet no longer requires that parameter names to Sybase stored procedures require the preceding at-sign.

NAME may also be the name of a column in a Sybase table. In this case TYPE, SIZE and MAXLENGTH are automatically determined. A fully qualified name may also include the name of the database and owner; for example, PDS.DBO.EMPPER.EMP_ID represents the column EMP_ID in table EMPPER owned by DBO in the database PDS; however, for efficieny sake, do not include the database name if you are already in that database.
value
 
VALUE is the default value of this field.

For numeric data, your VALUE parameter may contain gratutious commas. They will be stripped and reedited when your field is built.

If you are creating a drop-down list (type=select), the value can be a simple list of names separated by a delimiter (a,b,c,d), a list of name=value pairs (1=a,2=b,3=c,4=d) in which case both the value and text are specified, or a SQL select statement which is evaluated in real-time.
alert
 
ALERT calls the JavaScript function alert. The effect is an alert box with the message in this parameter, and the form is not submitted.
confirm
 
CONFIRM calls the JavaScript function confirm. This causes a warning or confirmation to be displayed that allows the user to cancel or allow the submit; for example, you may wish to warn them that a particular button is going to delete a record.
onblur
 
A blur event occurs when a select, text, or textarea field on a form loses focus. The onBlur event handler executes JavaScript code when a blur event occurs.
onclick
 
onClick handles the onClick event handler. In this case you must supply the complete JavaScript syntax yourself, and that is its purpose.

onClick may be specified for buttons, radio buttons, checkboxes, submit buttons and reset buttons.

ALERT, CONFIRM and onClick are invoked in this order. ALERT will override CONFIRM and onClick. CONFIRM will override onClick if its result is FALSE.
onchange
 
A change event occurs when a select, text, or textarea field loses focus and its value has been modified. The onChange event handler executes JavaScript code when a change event occurs.

The onChange event is where the SDK validates input fields. If specified, your onChange code occurs before any validation by the SDK.
onfocus
 
A focus event occurs when a field receives input focus by tabbing with the keyboard or clicking with the mouse. Selecting within a field results in a select event, not a focus event. The onFocus event handler executes JavaScript code when a focus event occurs.
onselect
 
A select event occurs when a user selects some of the text within a text or textarea field. The onSelect event handler executes JavaScript code when a select event occurs.
tagsize
 
TAGSIZE is the size of this input field.

If TAGSIZE is not specified and TYPE is a Sybase datatype, TAGSIZE is determined by that datatype; for example, the TAGSIZE of TINYINT will be 3 since the range of valid values are whole numbers between 0 and 255.

maxlength
 
MAXLENGTH is the maximum number of characters that may be specified in this field. If not specified, the default is 255.

If MAXLENGTH is not specified and TYPE is a Sybase datatype, MAXLENGTH is determined by that datatype; for example, the MAXLENGTH of a TINYINT field will be 3 since the range of valid values are whole numbers between 0 and 255 .
checked
 
CHECKED applies only to types of RADIO, CHECKBOX and SELECT. Its value is compared to the value of the VALUE parameter and sets the CHECKED (or SELECTED) option when the two are equal.

To set CHECKED manually, simply pass the same value for CHECKED and VALUE.
minvalue
 
If TYPE is a Sybase numeric field, minValue determines the minimum value allowed in this field. If minValue is not specified, the minimum value for that datatype is used instead; for example, the smallest value for a TINYINT is 0.

minValue is a string and can also be used to specify the minimum value allowed for char, varchar, datetime, and smalldatetime fields. In this case it is a good idea to provide a default value.
maxvalue
 
If TYPE is a Sybase numerc field, maxValue determines the maximum value allowed in this field. If maxValue is not specified, the maximum value for that datatype is used instead; for example, the largest value for a TINYINT is 255.

maxValue is a string and can also be used to specify the maximum value allowed for char, varchar, datetime, and smalldatetime fields.
rows
 
ROWS applies only to TYPE=TEXTAREA and indicates the number of rows to be displayed.
cols
 
COLS applies only to TYPE=TEXTAREA and indicates the number of columns to be displayed.
wrap
 
WRAP applies only to TYPE=TEXTAREA and indicates how text is wrapped when it is displayed and edited. NOWARP means no wrapping occurs. VIRTUAL means text wraps automatically to fit the textarea's window. PHYSICAL is similar to VIRTUAL except that carriage returns are physically inserted in the text at the end of each line.
delimeter
 
This parameter allows you to specify the delimeter used to separate list items when creating a drop-down list. You may need to override the default (a comma) if your list items contain commas.

For lists that allow multiple selections, delimeter is used to separate each item selected.
style
 
STYLE allows you to control the format for datetime and smalldatetime types and corresponds to the same in Sybase. Since date validations are done by JavaScript, some styles recognized by Sybase may not be recognized in JavaScript.

In Sybase, the STYLE 8 and 108 correspond to the time relative to January 1, 1900. In the SDK, STYLE 8 and 108 correspond to the time relative to January 1, 2000.

STYLE can also be the W3C inline style attribute. For Oracle programmers this is the desired usage while date formats are specified with the parameter NLS_DATE_FORMAT.
align
 
ALIGN determines whether or not you want to right-align numeric data when it is edited. Numeric data is any TYPE of TINYINT, SMALLINT, INT, NUMERIC, and DECIMAL. The SDK will also right-align any non-null VALUE when ALIGN is RIGHT.

ALIGN may be either LEFT, RIGHT, or NULL. When NULL, the default is FALSE unless the TYPE is MONEY or SMALLMONEY. MONEY and SMALLMONEY default to TRUE (right-alignment) when ALIGN is NULL.
scale
 
For numeric data, SCALE determines the number of decimal digits that are displayed. When NULL, SCALE will automatically default to the number of decimal digits that were entered by the user or 2 when the TYPE is one of MONEY or SMALLMONEY.
comma
 
This option determines whether or not numeric data is suppose to contain commas at the expected position. When TRUE, 1234 is displayed as 1,234. Since numeric fields containing commas are not valid Sybabase values, you will have to manually remove them before they are converted to a numeric data type.

If TYPE is one of MONEY or SMALLMONEY, the default is TRUE. For all other numeric types, the default is FALSE.
debug
 
For Internal Use Only.
procname
 
If TYPE is CHOOSE, this parameter determines the procedure name that should be scanned.
button
 
If TYPE is CHOOSE, this parameter determines the token name that should be scanned.
disabled
 
Determines if this field is disabled (true) or enabled (false).
readonly
 
Determines if this field is readonly (true) or editable (false).
tabindex
 
Determines the tab order of this field.
prologue
 
Forces a list item (<li>) at the beginning of your SELECT field.
epilogue
 
Forces a list item (<li>) at the end of your SELECT field.
multiple
 
Determines if this SELECT field can return multiple selections. If true, multiple selections are returned as one long string delimited by delimeter.
sorted
 
List items in your SELECT field are by default sorted. To inhibit this behavior because it is more natural to have the fields returned in the order specified, you can set sorted to false.
nls_date_format
 
The NLS_DATE_FORMAT to use for DATE fields.

Sybase programmers can refer to NLS_DATE_FORMAT only if that format corresponds to one of the pre-defined styles in Sybase.
evaluate
 
Determines if a TEXTAREA value should be evaluated in real time.
decoration
 
Allows you to specify the W3C style attribute. This was added for Oracle because STYLE was already reserved to handle Sybase styles. This version of sp_html_input allows you to use any combination of STYLE, NLS_DATE_FORMAT and DECORATION that makes sense to you.


Types

The following types are recognized by SP_HTML_INPUT. These types include the standard HTML input types as well as predefined types that correspond to similarly named datatypes in Sybase and Oracle.

The predefined types can include a default tag size, maxlength, value, minValue, maxValue, and scaling. You have the ability to override any or all of these defaults. A BIT type, for example, may be specified with a maxValue of 3.

Type Description
text
 
This is a standard TEXT field. There is no validation unless you provide your own validation with onChange.
button
 
This is a standard BUTTON object.
checkbox
 
This is a standard CHECKBOX object.
radio
 
This is a standard RADIO object.
reset
 
This is a standard RESET button.
submit
 
This is a standard SUBMIT button.
password
 
This is a standard PASSWORD field.
file
 
This is a standard FILE object. To use you must set ENCTYPE to "multipart/form-data."
hidden
 
This is a standard HIDDEN field.
select
 
This type creates a select list using the standard <SELECT> and </SELECT> tags. The VALUE parameter determines the list items. The CHECKED parameter determines which item is selected. By default list items are separated by a comma and the text part is sorted before it is displayed.

The VALUE parameter may be a simple list of names:


    VALUE => 'Red,Green,Blue'

which returns Red, Green, or Blue to your program. You can also define not only the TEXT portion of each option, but also the VALUE part. To do this you need to precede each item with its value followed by an equal sign.


    VALUE => '1=Red,2=Green,3=Blue'

which returns 1, 2, or 3 to your program. If NULL is an option, this can be accomplished by including a null item in your list.


    VALUE => ',Red,Green,Blue'

List items can also be derived in real-time by selecting them from a table:


    VALUE => 'SELECT NAME FROM HTTP.HTTP_COLORS'

To specify both the VALUE and TEXT you simply select two columns:


    VALUE => 'SELECT VALUE, NAME FROM HTTP.HTTP_COLORS'

but remember that the TEXT part is automatically sorted. You can suppress this if your select statement includes an ORDER BY clause:


    VALUE => 'SELECT VALUE, NAME FROM HTTP.COLORS ORDER BY VALUE'

although in this example it is more natural to order by NAME instead of by VALUE. When given the choice, I would always specify my own ORDER BY clause because Oracle can sort these items faster than I can.
textarea
 
This type creates a textarea using the standard <TEXTAREA> and </TEXTAREA> tags. The VALUE parameter determines the value of your textarea.

Like SELECT above VALUE may be a select statement. Only one column from a single row may be selected, but almost any column type is allowed, including a CLOB. If you attempt to retrieve a row greater than MAXLENGTH, an error is raised. An error is also raised if you attempt to retrieve more than one row. NULL is returned if no rows were found.

Here is an example that creates a textarea:

    http.sp_html_input
    (
        TYPE      => 'TEXTAREA'
    ,   VALUE     => 'Please fill this in'
    ,   ROWS      => '20'
    ,   COLS      => '60'
    )   ;

Here is an example that retrieves a CLOB:

    http.sp_html_input
    (
        TYPE      => 'TEXTAREA'
    ,   VALUE     => 'SELECT DESCRIPTION FROM HTTP.HTTP_HELPTEXT WHERE ROW_ID = ''Welcome'''
    ,   ROWS      => '20'
    ,   COLS      => '60'
    ,   MAXLENGTH => '32767'
    )   ;

MAXLENGTH should not be greater than 32767.
alpha
 
This special type allows letters only.
bit
 
This Sybase datatype is validated to insure that it is numeric and falls within the range of values supported by this type; for example, TINYINT must be an integral value between 0 and 255. Commas are also removed when the field is validated unless COMMAS=TRUE.
char
 
A character field and the same as text.
date
 
By default, date fields are converted to the form Month day, year; for example, Dec 25, 1995. The current implementation uses built-in JavaScript functions which automatically correct for invalid dates; for example, a date of "12/32/1996" is converted to "Jan 1, 1997." You can control the style of date formats with the STYLE parameter.
datetime
 
By default, date fields are converted to the form Month day, year; for example, Dec 25, 1995. The current implementation uses built-in JavaScript functions which automatically correct for invalid dates; for example, a date of "12/32/1996" is converted to "Jan 1, 1997." You can control the style of date formats with the STYLE parameter.
decimal
 
A numeric value.
int
 
This Sybase datatype is validated to insure that it is numeric and falls within the range of values supported by this type; for example, TINYINT must be an integral value between 0 and 255. Commas are also removed when the field is validated unless COMMAS=TRUE.
money
 
A comma-separated numeric field.
number
 
A numeric value.
numeric
 
A numeric value.
phone
 
This type removes non-numeric data when an onChange event occurs. This allows the user to enter these values in any format while at the same time making sure that only numeric data is returned to your procedure.
smalldatetime
 
By default, date fields are converted to the form Month day, year; for example, Dec 25, 1995. The current implementation uses built-in JavaScript functions which automatically correct for invalid dates; for example, a date of "12/32/1996" is converted to "Jan 1, 1997." You can control the style of date formats with the STYLE parameter.
smallint
 
This Sybase datatype is validated to insure that it is numeric and falls within the range of values supported by this type; for example, TINYINT must be an integral value between 0 and 255. Commas are also removed when the field is validated unless COMMAS=TRUE.
smallmoney
 
A comma-separated numeric value.
ssn
 
This type removes non-numeric data when an onChange event occurs. This allows the user to enter these values in any format while at the same time making sure that only numeric data is returned to your procedure.
telephone
 
A telephone number.
time
 
The TIME datatype converts time to a 24 hour clock value; for example, 2:15 pm is converted to 1415.
tinyint
 
This Sybase datatype is validated to insure that it is numeric and falls within the range of values supported by this type; for example, TINYINT must be an integral value between 0 and 255. Commas are also removed when the field is validated unless COMMAS=TRUE.
varvhar
 
A text field.
varchar2
 
A text field.


Defaults

The following table summarizes the default tag sizes and the min and max values. When calling SP_HTML_INPUT, you have the ability to override any of these values.

TYPE TAGSIZE MAXLENGTH MINVALUE MAXVALUE
ALPHA 30 255 null null
BIT 1 1 0 1
BLOB 30 32767 null null
BUTTON null null null null
CHAR 20 255 null null
CHECKBOX null null null null
CHOOSE 1 null null null
CLOB 30 32767 null null
DATE 12 26 null null
DATETIME 12 26 null null
DECIMAL 20 null null null
FILE null null null null
HIDDEN null null null null
INPUT 20 null null null
INT 14 14 -2147483648 2147483647
INTEGER 14 14 -2147483648 2147483647
MONEY 12 25 -922337203685477.5808 922337203685477.5807
NUMBER 20 null null null
NUMERIC 20 null null null
PASSWORD 30 30 null null
PHONE 13 13 null null
RADIO null null null null
RESET null null null null
SELECT 1 null null null
SMALLDATETIME 12 26 null null
SMALLINT 7 7 -32768 32767
SMALLMONEY 12 13 -214748.3648 214748.3647
SSN 11 11 null null
SUBMIT null null null null
TELEPHONE 24 24 null null
TEXT 20 null null null
TEXTAREA null 255 null null
TIME 8 8 null null
TINYINT 3 3 0 255
VARCHAR 20 255 null null
VARCHAR2 20 255 null null


Styles

DATE, DATETIME, and SMALLDATETIME are essentially the same data type. The table above illustrates each for style 107. The remaining styles are defined here.

STYLE TAGSIZE MAXLENGTH FORMAT
0 19 26 Mon DD YYYY HH12:MIAM
1 8 26 MM/DD/YY
2 8 26 YY.MM.DD
3 8 26 DD/MM/YY
4 8 26 DD.MM.YY
5 8 26 DD-MM-YY
6 9 26 DD Mon YY
7 10 26 Mon DD, YY
8 8 26 HH24:MM:SS
9 26 26 Mon DD YYYY HH12:MI:SS AM
10 8 26 MM-DD-YY
11 8 26 YY/MM/DD
12 6 26 YYMMDD
13 8 26 YY/DD/MM
14 8 26 MM/YY/DD
15 8 26 DD/YY/MM
100 19 26 Mon DD YYYY HH12:MIAM
101 10 26 MM/DD/YYYY
102 10 26 YYYY.MM.DD
103 10 26 DD/MM/YYYY
104 10 26 DD.MM.YYYY
105 10 26 DD-MM-YYYY
106 11 26 DD Mon YYYY
107 12 26 Mon DD, YYYY
108 8 26 HH24:MM:SS
109 26 26 Mon DD YYYY HH12:MI:SS AM
110 10 26 MM-DD-YYYY
111 10 26 YYYY/MM/DD
112 8 26 YYYYMMDD
113 10 26 YYYY/DD/MM
114 10 26 MM/YYYY/DD
115 10 26 DD/YYYY/MM

Example

The first example is a simple input field. There are two things to note about this example: the procedure will automtically quote the ADDRESS value for you, and this value will not be concatenated to any other string because that might result in truncation.

 
   http.sp_html_input
   (
       TYPE     => 'text'
   ,   NAME     => 'address'
   ,   VALUE    => ADDRESS
   ,   SIZE     => '30'
   )   ;

Example

Here are two radio buttons. sp_html_input will automatically determine if the button is checked based on the parameter name (PIZZA). This is actually very convenient because to do this yourself you would have to test whether or not PIZZA was equal to each button value.

 
    http.sp_html_input
    (
        TYPE      => 'radio'
    ,   NAME      => 'PIZZA'
    ,   VALUE     => 'Cheese'
    ,   CHECKED   => PIZZA
    )   ;

    http.sp_html_input
    (
        TYPE      => 'radio'
    ,   NAME      => 'PIZZA'
    ,   VALUE     => 'Pepperoni'
    ,   CHECKED   => PIZZA
    )   ;

Example

The next example illustrates how you can use Sybase datatypes when calling sp_html_input.

 
    http.sp_html_input
    (
        TYPE      => 'SMALLINT'
    ,   NAME      => 'Balance'
    )   ;

Example

Because they were not specified, the Sybernet SDK will automatically set both SIZE and MAXLENGTH to 6. It will also validate that the value in this field is a whole number between -32,768 and 32,767. Here's another example that overrides these defaults:

 
    http.sp_html_input
    (
        TYPE      => 'INT'
    ,   NAME      => 'Account'
    ,   SIZE      => '30'
    ,   MAXLENGTH => '30'
    ,   minValue  => '200000'
    ,   maxValue  => '299999'
    )   ;

Example

The next example specifies the Sybase datetype DATETIME and validates that the date entered is at least November 25, 1996.

 
    http.sp_html_input
    (
        TYPE      => 'DATETIME'
    ,   NAME      => 'Birthday'
    ,   minValue  => 'Nov 25, 1996'
    )   ;

Example

A standard submit button which displays a confirmation before submitting the form. The button is named because the procedure that receives this form wants to know which button the user clicked.

 
    http.sp_html_input
    (
        TYPE       => 'submit'
    ,   NAME       => 'button'
    ,   VALUE      => 'Save'
    ,   CONFIRM    => 'Are you sure you want to save this form?'
    )   ;

Example

Similar to the example above except an alert is displayed and the form is not submitted. Normally, this would be preceded by some condition that tests whether or not the user is allowed to click this button.

 
    http.sp_html_input
    (
        TYPE       => 'submit'
    ,   NAME       => 'button'
    ,   VALUE      => 'Drop'
    ,   ALERT      => 'You are not permitted to drop this form!'
    )   ;

Example

This is just a simple button that behaves exactly like the BACK button on your browser's tool bar. Notice that it uses the onClick event handler and supplies the entire JavaScript code in the onClick parameter.

 
    http.sp_html_input
    (
        TYPE        => 'button'
    ,   VALUE       => 'Back'
    ,   onClick     => 'window.history.back()'
    )   ;

Example

Version 2.22 of the Sybernet SDK introduced 3 new parameters that allow you to control how numeric data is displayed and edited by the user. They are ALIGN, SCALE and COMMA.

ALIGN may be either TRUE, FALSE or NULL. When TRUE, numeric data is right-aligned.

SCALE is a positive integer that determines the number of decimal digits that are displayed and edited. If zero, no decimal digits are displayed.

COMMAS may be either TRUE, FALSE or NULL. When TRUE, commas are inserted at the expected location.

 
    http.sp_html_input
    (
        TYPE       => 'NUMERIC'
    ,   VALUE      => '1,234.5678'
    ,   ALIGN      => 'TRUE'
    ,   SCALE      => '2'
    ,   COMMAS     => 'TRUE'
    )   ;
In the above example, the value is right-aligned, scaled to two decimal digits, and commas are inserted at the proper position. Notice too that the value contains commas; these are removed and then reinserted as expected.

Example

The following example illutrates how to create a drop-down list. The value part is simply a list of names separated by commas. The list is sorted automatically:

    http.sp_html_input
    (
        TYPE          => 'SELECT'
    ,   NAME          => 'FOOD'
    ,   VALUE         => 'Apples,Oranges,Pears,Turnips,Grapefruit,Watermelon,Pizza,Chicken'
    )   ;

Example

The same example except that I want to specify both the value and text values. To do this I simply pass these as pairs separated by an equal sign. The list is sorted by the text value in this case:

    http.sp_html_input
    (
        TYPE          => 'SELECT'
    ,   NAME          => 'FOOD'
    ,   VALUE         => '1=Apples,2=Oranges,3=Pears,4=Turnips,5=Grapefruit,6=Watermelon,7=Pizza,8=Chicken'
    )   ;

Example

The following example illustrates how to create a list dynamically using a table:

    http.sp_html_input
    (
        TYPE          => 'SELECT'
    ,   NAME          => 'PLATFORM'
    ,   VALUE         => 'SELECT PLATFORM FROM CRON_PLATFORMS'
    )   ;

Example

The following example illustrates how to select both value and text from a table. Because an order by clause was specified, the list is not sorted:

    http.sp_html_input
    (
        type          => 'SELECT'
    ,   name          => 'DATENAMES'
    ,   value         => 'select selectedIndex, datename from cron_datenames order by selectedIndex'
    )   ;

See Also

SP_HTML_BUTTON
SP_HTML_DATATYPES
SP_HTML_HREF
SP_HTML_FORM
SP_HTML_FRAME
SP_HTML_MENUBAR
SP_HTML_PREFERENCES
SP_HTML_SPACER


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