Differences between revisions 10 and 11
Revision 10 as of 2010-08-05 07:25:39
Size: 4875
Editor: KaiJaeger
Comment:
Revision 11 as of 2010-08-05 08:01:07
Size: 4877
Editor: KaiJaeger
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
<<Navigation(siblings)>> <<Navigation(siblings,1)>>
Line 111: Line 111:
<<Navigation(siblings)>> <<Navigation(siblings,1)>>

MildServer: The HTMLInput Namespace


HTMLInput Utilities

The file Utils\HTMLInput.dyalog contains the HTMLInput namespace, which contains utility functions which are used by all the examples. All the classes defined in the Utils folder are defined in the server workspace before the application starts. The easiest way to use these functions in your pages is to make sure your class source contains the following line:

:Include #.HTMLInput

The functions in the HTMLInput namespace are described in the following. In each case, the function name is bold, optional parameters are italic. Most functions take a name on the left and define both the id and name attributes to have this value. Where present, the parameter called attributes allows you to insert any additional attributes that you wish.

Function Reference

Button

Syntax: name Button value attributes

A button. Unless you are using JavaScript events to react to pressing the button, you should probably use the Submit function instead of Button. value is the text to be displayed. When values are posted, a parameter with the name of the button will be reported as having this value. A common technique is to give all your buttons the same name and use the reported value to determine which button was pressed.

Checkbox

Syntax: name CheckBox checked attributes

Defines an HTML input with type=checkbox, which is either checked or unchecked. For example:

      'Check1' CheckBox 1 'style="color: blue;"'
<input style="color: blue;" type=checkbox name=Check1 checked=1>

Syntax: name DropDown items value attributes sort

Defines a dropdown or combo box. items is the list of values to go in the list. value is the currently selected value. sort causes items to be sorted before they are inserted into the list.

Edit

Syntax: name Edit value size attributes

Generates a "normal" Edit or Input field. value is the data to insert into the field. size is the size.

Enclose

Syntax: tag Enclose html

Encloses arbitrary HTML in a tag. For example:

      'a href="http://www.dyalog.com"' Enclose 'Dyalog'
<a href="http://www.dyalog.com">Dyalog</a>  

File

Syntax: name File size value attributes

Generates an Input field which can be used to upload a file. size is the size of the field, value is the data to initialize the field with. Note that the value that is reported for this kind of field is a two-element vector: The file name and the data content of the file.

"Form"

Syntax: attributes (method Form) innerhtml

Form is actually a user-defined operator: method can be either post or submit. The right argument is simply some HTML which is to be embedded in the input form.

Hidden

Syntax: name Hidden value attributes

Generates an invisible Input field with the defined value. The user cannot see or change the content of this field, but it will be posted back to the server, so it is a way to store data between requests. The contents can also be seen by client-side code (JavaScript).

JS

Syntax: JS script

Embeds javascript.

MultiEdit

Syntax: name MultiEdit rowscols values attributes

Generates a multi-row Edit or Input field. rowscols gives the size. values is the data to insert into the field.

Password

Syntax: name Password size value attributes

An input field for entering input which should not be displayed as it is typed. value is the data to insert into the field. size is the size.

RadioButton

Syntax: name RadioButton checked value attributes

Defines an HTML input with type=radio, which is either checked or unchecked. The label is given by value.

Submit

Syntax: name Submit value attributes

A button which will submit the form that it is inside. value is the text to be displayed. When values are posted, a parameter with the name of the button will be reported as having this value. A common technique is to give all your buttons the same name and use the reported value to determine which button was pressed.

Table

Syntax: name Table data table_atts cell_atts header_atts header_rows

Wraps a matrix as an HTML table. The optional arguments are:

table_atts

Attributes for the table element

cell_atts

Attributes for td elements

header_atts

Attributes for header rows

header_rows

Indices of header rows

Return to the main MildServer page.

MiServer/HTMLInputRef (last edited 2013-12-24 13:02:44 by anonymous)