Wt: Wt::WValidationStatus Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WValidationStatus Class Reference

A widget that keeps track of the validation status of a form widget. More...

`#include <Wt/WValidationStatus>`

Inheritance diagram for Wt::WValidationStatus:
[legend]

List of all members.

## Public Member Functions
| WValidationStatus (WFormWidget *field, WWidget *validStateWidget=0, WWidget *invalidStateWidget=0, WWidget *invalidEmptyStateWidget=0, WContainerWidget *parent=0)
| Construct a WValidationStatus widget for another widget.
bool | valid () const
| Is the field currently considered valid?
Signal< bool > & | validated ()
| Signal emitted when the validation state changed.

## Detailed Description

A widget that keeps track of the validation status of a form widget.

Since Wt 2.1.3, all standard validators provide client-side validation and this is reflected in the form widget using the style class "Wt-invalid" when the validator returns not WValidator::Valid. Therefore, it is unlikely you will need this class anymore.

Use a WValidationStatus widget to act to changes in validation of a WFormWidget. The widget may show visual feed-back of the validation state of the input.

Visual feed-back may be given by showing an invalidStateWidget when input is invalid, an invalidEmptyStateWidget when the input is invalid because mandatory and empty, or a validStateWidget when input is valid. All of these widgets may be 0, indicating that no widget will be shown for the corresponding state.

When validation state changes from invalid to valid, or from valid to invalid, the widget emits the validated signal. This may be used to for example enable or disable a button.

Deprecated:
  Since Wt 3.1.1, validation is handled directly on WFormWidget subclasses.

## Constructor & Destructor Documentation

Wt::WValidationStatus::WValidationStatus | ( | WFormWidget * | field,
|  | WWidget * | validStateWidget = `0`,
|  | WWidget * | invalidStateWidget = `0`,
|  | WWidget * | invalidEmptyStateWidget = `0`,
|  | WContainerWidget * | parent = `0`
| ) |  |

Construct a WValidationStatus widget for another widget.

Constructs a validation status widget for the given field.

The validation stateWidgets (if not `0`) will be managed by this widget, and shown and hidden to reflect the current validation state.

## Member Function Documentation

Signal<bool>& Wt::WValidationStatus::validated | ( |  | ) |

Signal emitted when the validation state changed.

The new state of the validation (valid or invalid) is given as argument. This signal gets emitted when the state changes from WValidator::Valid to WValidator::Invalid, or from WValidator::Invalid to WValidator::Valid.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator