NormFormDemo
class NormFormDemo extends AbstractNormForm
Constants
FIRST_NAME |
Form field constant that defines how the form field for holding a first name is called (id/name). |
LAST_NAME |
Form field constant that defines how the form field for holding a last name is called (id/name). |
MESSAGE |
Form field constant that defines how the form field for holding a message is called (id/name). |
Properties
private array | $result | Holds the results of the form submission (assigned in business()). |
Methods
Validates the form submission. The criteria for this example are non-empty fields for first and last name.
Business logic method used to process the data that was used after a successful validation. In this example the received data is stored in result and passed on to the view. In more complex scenarios this would be the place to add things to a database or perform other tasks before displaying the data.
Details
at line 37
protected bool
isValid()
Validates the form submission. The criteria for this example are non-empty fields for first and last name.
These are checked using isEmptyPostField() in two separate if-clauses. If a criterion is violated, an entry in errorMessages is created. The array holding these error messages is then added to the parameters of the current view. If no error messages where created, validation is seen as successful.
at line 56
protected
business()
Business logic method used to process the data that was used after a successful validation. In this example the received data is stored in result and passed on to the view. In more complex scenarios this would be the place to add things to a database or perform other tasks before displaying the data.