| Path: | lib/smerf_system_helpers.rb |
| Last Update: | Sat Jan 12 15:57:19 +1100 2008 |
This module contains some standard helper methods used by smerf.
All validation methods need to take three parameters:
| question: | The SmerfQuestion object to be validated |
| responses: | Hash containing user responses keyed using the question code |
| form: | Hash that contains all form objects including groups, questions and answers |
The method needs to return an empty string or nil if no errors or if there is an error then an error message describing the error should be returned.
Within the form definition file you specify if a validation is required on a question by specifying which methods within this module should be called to perform that validation, e.g.
specify_your_age:
code: g1q1 type: singlechoice sort_order: 1 question: | Specify your ages help: | Select the <b>one</b> that apply validation: validation_mandatory
Multiple validation methods can be specified by comma separating each method name.