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 WDate & | bottom () 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 WDate & | top () 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 WString & | format () 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. |
This validator accepts input in the given date format, and checks if the the input was valid.
Construct a date validator.
The validator will accept only dates in the indicated range. The format is by default 'yyyy-MM-dd'
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&)
void Wt::WDateValidator::setFormat | ( | const WString & | format | ) |
Set the date format used to parse date strings.
const WString& Wt::WDateValidator::format | ( | ) | const [inline] |
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.
Parse a date from a string.
Equivalent to WDate::fromString(input, "yyyy-MM-dd");
Deprecated, see WDate::fromString() static methods