Show TOC Start of Content Area

Object documentation Input Field  Locate the document in its SAP Library structure

Definition

An framed area that allows user input. The inputField can be displayed with default input. A user can type new text or edit the existing text. The inputField control can be for client side eventing. See the EventValidationComponent description for more details.

·        BCD

Defines the value of the input field and the 'type' as data type Float (BCD = Binary Coded Decimal). The value has to match the data type format. This attribute combines the attributes 'type' and 'value'. See description of the 'type' attribute for more details how the inputField handles types.

·        date

Defines the value of the input field and the 'type' as data type Date. The value has to match the data type format according to the locale setting. This attribute combines the attributes 'type' and 'value'. See description of the 'type' attribute for more details how the inputField handles types.

·        design

Defines the size of the input field. The value for this attribute can be "STANDARD" or "SMALL".

·        enabled - inherited from EventValidationComponent.

A boolean value that defines if the inputField allows input. A disabled (enabled = false) inputField has a different background color.

·        firstDayOfWeek - Deprecated

The "first day of the week" that is displayed in the datenavigator (when you use input field "type=DATE" and "showHelp=true") is now controlled by the Java calendar class. The "firstDayOfWeek" attribute has no more effect on the datenavigator.

·        id

Identification name of the inputField.

·        jsObjectNeeded - inherited from Component.

A boolean value that defines if a JavaScript object has to be generated for the inputField component.

·        integer

Defines the value of the input field and the 'type' as data type Integer. The value has to match the data type format. This attribute combines the attributes 'type' and 'value'. See description of the 'type' attribute for more details how the inputField handles types.

·        maxlength

Defines the maximum amount of characters allowed for the inputField. If the type attribute is set for example, to date or time the 'maxlength' has to take care of the characters delivered by this format and local settings.

·        password

A boolean value that controls the echo of the inputField. If set to "true" the typed in characters are echoed - displayed as asterisks (*). A common use for this attribute is to inquire passwords.

·        required

This attribute sets a different style sheet class for a required inputField (that is a inputField that has to be filled out by the user). That gives you the opportunity do create a complete different look for a required inputfield (for example, light blue background). Use the 'label' control to indicate with a character that the inputField is required (for example, an asterisk).

·        showHelp

A boolean value that activates a help button when set to "true". 'showHelp' shows effect only when 'type' is set to "date". The help button pops up the date navigator allowing selection of the date by clicking on to the required day.

If you define a textView before the inputfield (to explain the meaning of the inputField) and than an inputField with enabled showHelp it is recommended to place the textView and the inputField in a grid or a tableView for better formatting.

If textView is not placed in a grid or tableView a line wrap between textView and inputField will occur.

·        size

Defines the width of the inputField in characters. The frame of the inputField is adjusted accordingly considering the actual text font and the design attribute.

The inputField width can also be set by the attribute 'width'. If 'size' and 'width' are set the 'width' attribute has priority and overwrites the 'size' setting.

·        tooltip

Defines the hint of the inputField which is displayed as the mouse cursor passes over the inputField, or as the mouse button is pressed but not released.

·        time

Defines the value of the input field and the 'type' as data type Time. The value has to match the data type format according to the locale setting. This attribute combines the attributes 'type' and 'value'. See description of the 'type' attribute for more details how the inputField handles types.

·        type

If 'type' is set to date a help button to call the dateNavigator can be generated (see 'showHelp'). For all other types for the inputField, the frame of the inputField is displayed in red, if the value does not match the type (for example, 'type' is set to Integer and 'value' is "ABC").

·        valid

A boolean value that controls the frame of the inputField.

invalid="true": InputField is displayed with a red frame.

invalid="false": InputField is displayed with the regular frame color

·        value

Default string that is displayed in the inputField frame. The 'maxlength' attribute has no effect on the 'value' attribute. The 'value' string is not truncated to 'maxlength'. By default the value is handled as data type string. For other data types set the 'type' attribute or use the BCD, Date, Integer or Time methods to set the value.

·        visible

A boolean value that defines if the inputField is visible or invisible.

·        width

Defines the width of the inputField in pixel or percent. This attribute allows better adjustment of the inputField in a form.

The inputField width can also be set by the attribute 'width'. If 'size' and 'width' are set the 'width' attribute has priority and overwrites the 'size' setting.

 

Attributes

M

Values

Usage

BCD

 

String

Taglib
No tag available

Classlib
setBCD ("1.15")

date

 

String

Taglib
No tag available

Classlib
setDate ("3.12.2003")

design

 

STANDARD (d)
SMALL

Taglib
design="SMALL"

Classlib
setDesign("SMALL")

enabled*

 

FALSE
TRUE (d)

Taglib
disabled="TRUE"

Classlib
setEnabled(false)

id

*

String (cs)

Taglib
id="GetInput"

Classlib
setId("GetInput")

jsObjectNeeded**

 

FALSE (d)
TRUE

Taglib
jsObjectNeeded="TRUE"

Classlib
setJsObjectNeeded(true)

integer

 

 

Taglib
No tag available

Classlib
setInteger("10")

maxlength

 

 

Taglib
maxlength="25"

Classlib
setMaxlength(25)

password

 

FALSE (d)
TRUE

Taglib
password="TRUE"

Classlib
setPassword(true)

required

 

FALSE (d)
TRUE

Taglib
required="TRUE"

Classlib
setRequired(true)

showHelp

takes effect only if ‘type’ is set to “date”.

 

FALSE (d)
TRUE

Taglib
showHelp="TRUE"

Classlib
setShowHelp(true)

size

 

Numeric (30)

Taglib
size="35"

Classlib
setSize("35")

time

 

String

Taglib
No tag available

Classlib
setTime("00:14:01")

tooltip

 

String

Taglib
No tag available

Classlib
setTooltip("Order number")

type

 

BCD
BOOLEAN
DATE
INTEGER
STRING
TIME

Taglib
type="INTEGER"

Classlib
setType(DataType.INTEGER)

valid

 

FALSE
TRUE (d)

Taglib
invalid="TRUE"

Classlib
setValid(false)

value

 

String

Taglib
value="Your name here"

Classlib
setValue("Your name here")

visible

 

FALSE
TRUE (d)

Taglib
visible="false"

Classlib
setVisible(false)

width

 

Unit

Taglib
width="200"

Classlib
setWidth("200")

* Method is inherited from the EventValidationComponent component. Therefore the attribute is different between the taglib and the classlib.

** Method is inherited from the Component component.

 

See the JavaScript API description for details how to access the component in JavaScript.

 

Example

using the taglib

 <hbj:inputField 
    id=
"InputName" 
    
type="string" 
    
maxlength="100" 
    
value="Your name here" 
    
/>

 

using the classlib

    Form form = (Form) this.getForm();
    InputField input = 
new InputField("InputName");
    input.setType(DataType.STRING);
    input.setMaxlength(100);
    input.setValue(
"Your name here");
    form.addComponent(input);

 

Result

This graphic is explained in the accompanying text

 

End of Content Area