Bug #1723
closedInformation gets deleted from map
Description
I ran into a bug today. I entered information into the external reference field but forgot to set a precision. After trying to save the data (which of course did not work), all the information I drew into the map was deleted. The same happens when I enter invalid data into the date fields.
Updated by Alexander Watzinger over 2 years ago
- Category set to Maps
- Status changed from New to Assigned
- Assignee set to Andreas Olschnögger
- Target version set to 7.4.0
Can confirm
Updated by Alexander Watzinger over 2 years ago
We would need to validate the form before submission so that if the identifier field of a reference system (e.g. Wikidata) isn't empty, the precision has to be set too. It might be tricky because these fields are generating dynamically but I hope you (Andi) can figure something out.
Although this won't solve the underlying issue (losing form data if backend validation fails, we would have to look into this at some point too) it would be great if JavaScript validation for reference systems could be solved before the next release to at least remedy that point of failure, which probably happens quite often.
There is already some general validation code in: openatlas/static/js/forms.js
Place were reference systems are added to forms: openatlas/util/util.py -> add_reference_systems_to_form()
Example form: https://demo.openatlas.eu/insert/place
As always, in case of questions we can take a look at it together.
Updated by Alexander Watzinger over 2 years ago
- Related to Feature #1736: Keep form map data after failed backend validation added
Updated by Andreas Olschnögger over 2 years ago
- Status changed from Assigned to Resolved
Now the input fields for the precisions are validated before submission. It is only checked weather it is empty or not.
Other more complex validation like correct dates or correct id format are still done after submission.
Changes are on develop
Updated by Alexander Watzinger over 2 years ago
- Status changed from Resolved to Closed
I tested it and seems to work great.
I also created a new issue (#1736) for the underlying problem and put a related link to this issue and, as already mentioned, will take a look at it myself.
Thanks a lot Nina for reporting and Andi for adding the JavaScript validation.