Wt::WFormWidget Class Reference

An abstract widget that corresponds to an HTML form element. More...

#include <Wt/WFormWidget>

Inheritance diagram for Wt::WFormWidget:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WFormWidget (WContainerWidget *parent=0)
 Construct a WFormWidget with an optional parent.
 ~WFormWidget ()
 Destroy a WFormWidget.
WLabellabel () const
 Returns the label associated with this widget.
virtual void setHidden (bool hidden)
 Set the hidden state of this widget.
bool isEnabled () const
 Return whether the widget is enabled.
void setValidator (WValidator *validator)
 Set a validator for this field.
WValidatorvalidator () const
 Get the validator.
virtual WValidator::State validate ()
 Validate the field.
void setEnabled (bool enabled)
 Change the enabled state of the widget.
void enable ()
 Enable the widget.
void disable ()
 Disable the widget.
void setFocus ()
 Give focus to this widget.
void setReadOnly (bool readOnly)
 Set the element read-only.
bool isReadOnly () const
 Returns whether the form element is read-only.
EventSignalchanged ()
 Signal emitted when the value was changed.
EventSignalselected ()
 Signal emitted when ??
EventSignalblurred ()
 Signal emitted when the widget lost focus.
EventSignalfocussed ()
 Signal emitted when the widget recieved focus.


Detailed Description

An abstract widget that corresponds to an HTML form element.

A WFormWidget may receive focus, can be disabled, and can have a label that acts as proxy for getting focus. It provides signals which reflect changes to its value, or changes to its focus.

Form widgets also have built-in support for validation, using setValidator(WValidator *). If the validator provide client-side validation, then an invalid validation state is reflected using the style class "Wt-invalid". All validators provided by Wt implement client-side validation.

On the server-side, use validate() method to validate the content using a validator previously set.


Constructor & Destructor Documentation

Wt::WFormWidget::~WFormWidget (  ) 

Destroy a WFormWidget.

If a label was associated with the widget, its buddy is reset to 0.


Member Function Documentation

WLabel* Wt::WFormWidget::label (  )  const [inline]

Returns the label associated with this widget.

Returns the label (if there is one) that acts as a proxy for this widget.

See also:
WLabel::setBuddy(WFormWidget *)

void Wt::WFormWidget::setHidden ( bool  hidden  )  [virtual]

Set the hidden state of this widget.

If the widget has a label, it is hidden and shown together with this widget.

Reimplemented from Wt::WWebWidget.

void Wt::WFormWidget::setValidator ( WValidator validator  ) 

Set a validator for this field.

The validator is used to validate the current input.

If the validator has no parent yet, then ownership is transferred to the form field, and thus the validator will be deleted together with the form field.

The default value is 0.

See also:
validate()

void Wt::WFormWidget::setEnabled ( bool  enabled  ) 

Change the enabled state of the widget.

A widget that is disabled cannot receive focus or user interaction.

void Wt::WFormWidget::enable (  ) 

Enable the widget.

See also:
setEnabled(bool)

void Wt::WFormWidget::disable (  ) 

Disable the widget.

See also:
setEnabled(bool)

void Wt::WFormWidget::setFocus (  ) 

Give focus to this widget.

Giving focus to an input element only works when JavaScript is enabled.

void Wt::WFormWidget::setReadOnly ( bool  readOnly  ) 

Set the element read-only.

A read-only form element cannot be edited, but the contents can still be selected.

By default, a form element area is not read-only.

See also:
setEnabled()

bool Wt::WFormWidget::isReadOnly (  )  const

Returns whether the form element is read-only.

See also:
setReadOnly()


Generated on Tue Sep 1 17:51:15 2009 for Wt by doxygen 1.5.6