Home

# Class goog.ui.LabelInput

This creates the label input object.

extends goog.ui.Component

Instance Method Summary
| `attachEventsToForm_()` Adds a listener to the form so that we can clear the input before it is submitted.
| `attachEvents_()` Attaches the events we need to listen to.
| `check_()` Checks the state of the input element
| `clear()` Clears the value of the input element without resetting the default text.
| `createDom()` Creates the DOM nodes needed for the label input.
| `decorateInternal(?HTMLInputElement element)` Decorates an existing HTML input element as a label input. If the element has a "label" attribute then that will be used as the label property for the label input object.
| `detachEvents_()` Stops listening to the events.
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `enterDocument()` Called when the DOM for the component is for sure in the document.
| `exitDocument()` Called when the DOM for the component is removed from the document or when the component no longer is managing the DOM.
| `focusAndSelect()` This method focuses the input and if selects all the text. If the value hasn't changed it will set the value to the label so that the label text is selected.
| `focusAndSelect_()`
| `getLabel() ⇒ string`
| `getValue() ⇒ string` Returns the current value of the text box, returning an empty string if the search box is the default value
| `handleAfterSubmit_(?Event e)` Restore value after submit
| `handleBlur_(?goog.events.Event e)` Handler for the blur event.

`handleEscapeKeys_(?goog.events.BrowserEvent e)`

Handler for key events in Firefox. If the escape key is pressed when a text input has not been changed manually since being focused, the text input will revert to its previous value. Firefox does not honor preventDefault for the escape key. The revert happens after the keydown event and before every keypress. We therefore store the element's value on keydown and restore it on keypress. The restore value is nullified on keyup so that {@link #getValue} returns the correct value. IE and Chrome don't have this problem, Opera blurs in the input box completely in a way that preventDefault on the escape key has no effect.

| `handleFocus_(?goog.events.Event e)` Handler for the focus event.
| `handleFormSubmit_(?goog.events.Event e)` Handler for the submit event of the form element.
| `handleWindowLoad_(?Event e)` Handler for the load event the window. This is needed because IE sets defaultValue upon load.
| `hasChanged() ⇒ boolean`
| `hasFocus() ⇒ boolean`
| `isEnabled() ⇒ boolean`
| `reset()` Clears the value of the input element and resets the default text.
| `restoreLabel_()` Sets the value of the input element to label.
| `setEnabled(boolean enabled)` Enables/Disables the label input.
| `setLabel(string label)` Sets the label text.
| `setValue(string s)` Use this to set the value through script to ensure that the label state is up to date