jcl.DataInputBehavior

Implementation of a DataInput control.
This control allows displaying data from OpenAjax events in <input> elements and publishing OpenAjax events when the user changes the value.

Source file: ~/controls/DataInput.js

Attributes

nosubmit

Enable the ENTER Key on input elements without submitting a html-form.

datatype

The datatype of the input element.

prec

Precision for numeric types.

eventname

The local or complete event name that is used for publishing OpenAjax events.

helptext

the helptext is displayed when the field is empty and has no focus.

Event handlers

onfocus

Handle the onfucus event. Remove the helptext when the focus enters the field and no real value is present.

onblur

Handle the onblur event. Add the helptext when the focus leaves the field and no real value is present.

onkeypress

Handle the onkeypress event. Analyse the pressed key and allow only valid key entries. This feature is useable for numeric values and helps avoiding bad formats. map some key to others: This feature can be used to map decimal separators.

onchange

Handle the onchange event and revalidate the current value.

Public methods

init ()

Initialze the JavaScript control.

afterinit ()

After loading the page the other components should know about the current value.

handleEvent (eventName, eventData)

OpenAjax event handler that captures any changed values.

setData (v)

Display a new value.

getData ()

Return the actual value of the input field.

clearData ()

Clear the current value.

resetData ()

Reset the actual value to the initial defined value.

validate ()

Validate and reformat the current value.

Private elements

_isEmpty ()

Return true if the current value is empty and a helptext might be displayed.

_keys

_mapkeys

_toString (v)

_toValue (v)


This page is part of the http://www.mathertel.de/ web site.