예제 #1
0
WValidator::State WFormWidget::validate()
{
  if (validator()) {
    WValidator::Result result = validator()->validate(valueText());

    toggleStyleClass("Wt-invalid", result.state() != WValidator::Valid, true);
    setToolTip(result.message());

    validated_.emit(result);

    return result.state();
  } else
    return WValidator::Valid;
}
예제 #2
0
void WTemplateFormView::indicateValidation(WFormModel::Field field,
					   bool validated,
					   WText *info,
					   WWidget *edit,
					   const WValidator::Result& validation)
{
  info->setText(validation.message());

  if (validated) {
    WApplication::instance()->theme()
      ->applyValidationStyle(edit, validation, ValidationAllStyles);

    info->toggleStyleClass("Wt-error", validation.state() != WValidator::Valid,
			   true);
  } else {
    WApplication::instance()->theme()
      ->applyValidationStyle(edit, validation, ValidationNoStyle);

    info->removeStyleClass("Wt-error", true);
  }
}
예제 #3
0
파일: WFormWidget.C 프로젝트: DTidd/wt
WValidator::State WFormWidget::validate()
{
  if (validator()) {
    WValidator::Result result = validator()->validate(valueText());

    if (isRendered())
      WApplication::instance()->theme()
	->applyValidationStyle(this, result, ValidationInvalidStyle);

    if (validationToolTip_ != result.message()) {
      validationToolTip_ = result.message();
      flags_.set(BIT_VALIDATION_CHANGED);
      repaint();
    }

    validated_.emit(result);

    return result.state();
  } else
    return WValidator::Valid;
}