Wt examples  4.10.4
Form.h
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 
8 #ifndef FORM_H_
9 #define FORM_H_
10 
11 #include <Wt/WTable.h>
12 
13 using namespace Wt;
14 
15 namespace Wt {
16  class WContainerWidget;
17  class WText;
18  class WTextArea;
19  class WLineEdit;
20  class WComboBox;
21  class WFormWidget;
22  class WDateEdit;
23 }
24 
29 
35 class Form : public WTable
36 {
37 public:
40  Form();
41 
42 private:
46 
49  void submit();
50 
51  void createUI();
52 
54 
57 
60 
64 
66 
70 
73  bool validate();
74 
80  bool checkValid(WFormWidget *edit, const WString& text);
81 };
82 
85 #endif // FORM_H_
A simple Form.
Definition: Form.h:36
WLineEdit * firstNameEdit_
Definition: Form.h:56
WComboBox * cityEdit_
Definition: Form.h:59
bool checkValid(WFormWidget *edit, const WString &text)
Validate a single form field.
WComboBox * countryEdit_
Definition: Form.h:58
WDateEdit * birthDateEdit_
Definition: Form.h:61
void addValidationStatus(int row, WFormWidget *field)
Add a validation feedback for a field.
void countryChanged()
The user selected a new country: adjust the cities combo box.
Form()
Instantiate a new form.
void createUI()
WContainerWidget * feedbackMessages_
Definition: Form.h:53
void submit()
Submit the form.
WLineEdit * childCountEdit_
Definition: Form.h:62
WLineEdit * weightEdit_
Definition: Form.h:63
WLineEdit * nameEdit_
Definition: Form.h:55
WTextArea * remarksEdit_
Definition: Form.h:65
bool validate()
Validate the form, and return whether succesfull.
void field(Action &action, V &value, const std::string &name, int size=-1)