Wt::WDateValidator Class Reference

A validator for date strings. More...

Inheritance diagram for Wt::WDateValidator:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WDateValidator (const WDate &bottom=WDate(), const WDate &top=WDate())
 Construct a date validator.
 WDateValidator (const WString &format, const WDate &bottom=WDate(), const WDate &top=WDate())
 Construct a date validator.
void setInvalidNotADateText (const WString &text)
 Set the message to display when the input is not a date.
void setBottom (const WDate &bottom)
 Set the bottom of the valid date range.
const WDatebottom () const
 Get the bottom date of the valid range.
void setInvalidTooEarlyText (const WString &text)
 Set message to display when the date is earlier than bottom.
void setTop (const WDate &top)
 Set the top of the valid date range.
const WDatetop () const
 Get the top date of the valid range.
void setInvalidTooLateText (const WString &text)
 Set message to display when the date later than top.
void setFormat (const WString &format)
 Set the date format used to parse date strings.
const WStringformat () const
 Get the format string used to parse date strings.
virtual State validate (WString &input, int &pos) const
 Evaluate the validness of the given input.
virtual void createExtConfig (std::ostream &config) const
 Provide Ext-compatible config options for client-side validation.

Static Public Member Functions

static WDate parse (const WString &input)
 Parse a date from a string.


Detailed Description

A validator for date strings.

This validator accepts input in the given date format, and checks if the the input was valid.


Constructor & Destructor Documentation

Wt::WDateValidator::WDateValidator ( const WDate bottom = WDate(),
const WDate top = WDate() 
)

Construct a date validator.

The validator will accept only dates in the indicated range. The format is by default 'yyyy-MM-dd'

See also:
WDate::fromString(const WString&, const WString&)

Wt::WDateValidator::WDateValidator ( const WString format,
const WDate bottom = WDate(),
const WDate top = WDate() 
)

Construct a date validator.

The validator will accept only dates in the indicated range. The format follows the syntax of WDate::fromString(const WString&, const WString&)

See also:
WDate::fromString(const WString&, const WString&)


Member Function Documentation

void Wt::WDateValidator::setFormat ( const WString format  ) 

Set the date format used to parse date strings.

See also:
WDate::fromString(const WString&, const WString&)

const WString& Wt::WDateValidator::format (  )  const [inline]

Get the format string used to parse date strings.

See also:
setFormat()

WValidator::State Wt::WDateValidator::validate ( WString input,
int &  pos 
) const [virtual]

Evaluate the validness of the given input.

This function returns the current state of the input.

The function can change both input and pos (the cursor position) if required.

Reimplemented from Wt::WValidator.

WDate Wt::WDateValidator::parse ( const WString input  )  [static]

Parse a date from a string.

Equivalent to WDate::fromString(input, "yyyy-MM-dd");

Deprecated, see WDate::fromString() static methods


The documentation for this class was generated from the following files:
Generated on Mon Apr 14 15:15:01 2008 for Wt by doxygen 1.5.3