# input element

Type: | Forms
Attributes: | alias • checked • default-value • editable • handler • keypassword • keystore • keystoretype • lines • location • maxlength • name • onchange • onclick • onfocus • onformat • onkeypress • onmousedown • onmouseover • onotherchange • password • readonly • reason • required • scrollable • signer • src • submitted • type • value • visibility • align • background-color • background-image-dpi • background-image-position • background-image • background-pdf • border-color • border-style • border-width • border • clear • corner-radius • display • float • font-size • height • href • left • line-cap • line-height • line-join • margin • onmouseover • overflow • padding • page-break-after • page-break-inside • position • rotate • size • top • vertical-align • visibility • white-space • width • class • colorspace • direction • id • lang
See: | a div img option

The input tag defines a form element in the document. A form element is a block element, like an img or div, and as such may use all of the attributes that are used by those elements.
In addition form elements allows interaction with the user and can be submitted to a webserver, in the same way as an HTML form element. Much of the syntax for the input element is the same to the "input" element in HTML. There is no equivalent of the HTML "form" element - input fields are added directly to the document.
Note use of this tag requires the "Extended Edition" of the Report Generator
Each input element must specify the type attribute and the name attribute, which (with the exception of radio buttons) must be unique across the entire document.
The type of input element depends on the type attribute, which along with the name attribute is mandatory. Valid values for type are "text", "file", "password", "button", "radio", "checkbox", "select" or "signature".
When type is text the input field functions as a textbox. Any value may be entered. The lines attribute may be set to convert the field into a multiline box, similar to the "textarea" element in HTML. The maxlength attribute may be set to limit the number of characters entered (the width attribute determines the width of the field on the page). The value attribute may be set to the value of the field, otherwise this is set to the value of the elements contents.
When type is file, the input field is identical to a textbox except that the value entered into the field is a filename, the contents of which is sent when the form is submitted. The value of lines is ignored.
When type is password, the input field is identical to a textbox except that any value entered is replaced with "*" characters. The value of lines is ignored.
When type is button, the input field is a pushbutton. Usually the button will have an onclick handler to cause an action to occur when the button is clicked (like submitting the form, for example). Button fields may have a value attribute specified to set the text that appears on the button, or a src attribute which specifies the URL of an image to place on the button.
When type is radio, the input field is a radio button. In this case the value attribute is mandatory and must be set to the value of the radiobutton. Radio buttons are grouped together by using the same name attribute - this is the only exeception to the "use a unique name for each form element" rule. The checked attribute may be used to turn the button on by default.
When type is checkbox, the input field is a checbox. The checked attribute may be used to turn the checkbox on by default.
When type is select, the input field is a drop-down or scrollable list, very similar to the "select" element in HTML. Like that element, it should also contain one or more option elements as children. The lines attribute may be set to any value > 1 to cause the list to be scrollable, rather than drop-down. Alternatively, the editable attribute may be set to "true" to cause the list to function as a "combo-box" - a value can be typed, in the same way as a Text box, or one can be selected from the drop-down list. In addition, the value attribute may be set to set which list element is selected. Multiple-values can not be selected in a list at this time.
When type is signature, the input field represents a digital signature. This type of field is quite different to the others, mainly because in the current release it does not appear on the page. Consequently the width and height attribute are best left at their default of zero. Digital signatures are covered in more depth in the userguide, but the mandatory attributes are handler, keystore and alias, and the optional attributes are keystoretype, password, keypassword, signer, location and reason.

A single line text box

    <input type="text" name="surname" maxlength="20" value="Smith"/>

A multi-line text box. The value is set to the contents of the element.

    <input type="text" name="address" lines="4" scrollable="no">
    14 Carlyle Street
    Westminster
    London SW1
    </input>

A password box

    <input type="password" name="password"/>

A button element that submits the form to a URL

    <input type="button" name="submit" value="Submit" onClick="pdf:submit(http://localhost)"/>

A button element that resets the form, and has an image instead of text.

    <input type="button" name="reset" value="" src="myimage.jpg" onClick="pdf:reset()"/>

A series of radio buttons. Only one of these buttons may be selected at once.

    <input type="radio" name="sex" value="Male" checked="true"/>
    <input type="radio" name="sex" value="Female"/>

A series of checkboxes. Each of these boxes is independent

    <input type="checkbox" name="Java" checked="true"/>
    <input type="checkbox" name="C"/>
    <input type="checkbox" name="Perl"/>

A series of checkboxes. Each of these boxes is independent

    <input type="checkbox" name="Java" checked="true"/>
    <input type="checkbox" name="C"/>
    <input type="checkbox" name="Perl"/>

A drop-down list. Only one of these elements can be chosen

    <input type="select" name="OS">
      <option value="Win95">Windows 95/98</option>
      <option value="WinNT">Windows NT/2000</option>
      <option value="OSX">Macintosh OS X</option>
      <option value="OS9">Macintosh OS 9</option>
      <option value="Linux">Linux</option>
      <option value="Solaris">Solaris</option>
      <option value="BSD">FreeBSD</option>
    </input>

A scrollable list. Identical to the previous example, but formatted differently.

    <input type="select" name="OS">
      <option value="Win95">Windows 95/98</option>
      <option value="WinNT">Windows NT/2000</option>
      <option value="OSX">Macintosh OS X</option>
      <option value="OS9">Macintosh OS 9</option>
      <option value="Linux">Linux</option>
      <option value="Solaris">Solaris</option>
      <option value="BSD">FreeBSD</option>
    </input>

An editable drop-down list, or "combo box". The user can select a value or enter their own.

    <input type="select" name="Country">
      <option>USA</option>
      <option>Canada</option>
      <option>Germany</option>
      <option>UK</option>
      <option>France</option>
    </input>

A digital signature.

    <input type="signature" name="sig1" keystore="file:/path/to/keystore.jks" keystoretype="jks-SUN"
           alias="MyKey" password="secret" handler="selfsign" signer="John Paul"
           reason="I am the author of this document" location="Roma">