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

HTTP.SP_HTML_DATATYPES

This application allows you to create HTML input fields. Obviously you can't define new types that your browser doesn't recognize, but you can declare types that are built on top of the basic HTML types. Even the basic types (like TEXT) are defined through this application. If you delete this definition, you will not be able to create this field via sp_html_input, and you will probably break most of the stored procedures in Sybernet.

When invoked, you are presented with a list of all defined types. Here you will see the basic HTML types like TEXT, RADIO, and CHECKBOX. You will also see some Sybase and Oracle types (like BIT and NUMBER) that are built on top of these types. To edit any of these types, click its name. To create a new type, click the button at the bottom of this screen.

In edit mode, enter your changes and click Save or Apply. Clicking Save updates this type and returns you to the list of defined types. Clicking Apply updates this type and keeps you in edit mode. If you want to delete this type, click Delete. If you want to test this type, click Exercise.


Options

The following table illustrates the attributes that may be specified when you define your HTML input fields. This list is complete, but you will notice that it is a subset of the parameters that can be passed to sp_html_input; for example, you can pass onDblClick to sp_html_input, but you can't define its default value with this application.

Parameter Description
name
 
Defines the name of this type. This is the TYPE parameter that is passed to sp_html_input.
type
 
Defines the HTML type.
data_type
 
Defines the Oracle or Sybase data type.
value
 
Defines the default value for this type.
checked
 
Defines the value for default selected. This applies to SELECT, RADIO, and CHECKBOX.
title
 
Defines a tool tip.
tagsize
 
Defines the default tag size.
maxlength
 
Defines the default max length.
minvalue
 
Defines the minimum value of a numeric field.
maxvalue
 
Defines the maximum value of a numeric field.
align
 
Determines if this field is LEFT or RIGHT aligned.
comma
 
Determines if commas are inserted for numeric characters.
scale
 
Defines the scaling for this numeric field.
style
 
Defines the in-line W3C style for this field.
onchange
 
Defines the Javascript onChange event for this field. OnChange is always appended to any user specified values for this attribute.
onclick
 
Defines the Javascript onClick event for this field.
rows
 
Defines the default number of rows for a textarea.
cols
 
Defines the default number of columns for a textarea.
multiple
 
Determines if this SELECT tag allows multiple values.
disabled
 
Determines if this field is disabled.
readonly
 
Determines if this field is read-only.


Example

I might want to define a type called EMPLID whose tag size is 5 and whose max length is 11. To do this by calling sp_html_input I would submit something like the following:

    http.sp_html_input
    (
        type => 'text'
    ,   tagsize => 5
    ,   maxlength => 11
    )   ;

What I might want to do is to define a new type called EMPLID with a tag size of 5 and a maxlength of 11. Doing so means I can refer to this type as EMPLID and any application that refers to this name will behave exactly like any other application that refers to this name. Here is an example of how I would refer to this new type.

    http.sp_html_input
    (
        type => 'emplid'
    )   ;

Should the minimum or maximum value of this field ever change I only need to change it in one place. Also note that the invoker's parameters take precedence over the definition. Just like the default tag size for a text field is 20 characters I can override that default by specifying my own tag size. Similarly, I can also override our new definition for EMPLID and set the tag size to anything I want.



Example

Probably the best illustration of this facility is when you define a SELECT field that requires a farily non-trivial select statement to generate its contents. The select statement to return DEPTID and DESCRLONG from the table PS_DEPT_TBL looks something like this:

    select deptid
    ,      descrlong
    from   ps_dept_tbl
    where  eff_statue       = 'A'
    and    effdt            =
    (
        select max(effdt)
        from   ps_dept_tbl b
        where  b.deptid    = ps_dept_tbl.deptid
        and    b.effdt    <= sysdate
    )

I can define a new name called DEPTID whose type is SELECT and whose VALUE is the above SQL statement. Once defined all I need to do is refer to this new type in my call to sp_html_input.

    http.sp_html_input
    (
        type => 'deptid'
    ,   checked => '023'
    )   ;

Passing the value for checked is gratuitous. I could have specified this when I defined this new type or left it NULL. The point here is that the invoker still has some control over how this field is displayed. I could define this field with a tag size of 3 and set multiple to true. The invoker can override this and set the tag size to 1 and multiple to false.



See Also

JAVASCRIPT
SP_HTML_INPUT



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