rdmo icon indicating copy to clipboard operation
rdmo copied to clipboard

Use value_types for validation

Open jochenklar opened this issue 2 years ago • 1 comments

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

jochenklar avatar Apr 12 '22 09:04 jochenklar

Maybe this can be extended to more sophisticated value_types like email or telephone number.

jochenklar avatar Apr 28 '22 16:04 jochenklar