rdmo
rdmo copied to clipboard
Use value_types for validation
Rationale / Begründung
User input could be validated to improve input quality. Questions already have a value_type
which is rarely used in RDMO (mainly to distinguish dates/booleans [1] from text input and to find files as attachments [2,3]). It could also be used to validate input in the user interface and force certain kind of data to be entered (e.g. URL, numbers, etc.). Value types in the catalog are also inconsistent, since the value type option
is de-factor deprecated. Determining if a value contains an option
or a file
could better be checked by looking at the model fields.
References / Verweise
[1] https://github.com/rdmorganiser/rdmo/blob/master/rdmo/projects/models/value.py#L134 [2] https://github.com/rdmorganiser/rdmo/blob/master/rdmo/projects/views/project_view.py#L44 [3] https://github.com/rdmorganiser/rdmo/blob/master/rdmo/projects/views/project_answers.py#L50
Maybe this can be extended to more sophisticated value_types like email or telephone number.