I’m hoping someone can help me with what I expect is a very simple problem… I have a simple domain model with 2 entities and an association between them: I then have a very simple page containing 2 Data Views, one that lists the attributes of a chosen Carrier entity and another below that that lists any Processes linked to that chosen Carrier entity. The 2nd data view (that lists linked processes) has an edit button that opens up a separate page to create new processes. This page contains input elements for each attribute, and all of them have Validation type ‘Required’ set in their properties. During testing, we noted that if you try creating a new process on the edit page, hit save but with some fields empty (so the validation warnings appear), then click the menu bar navigation link to go directly back to the main page, the 2nd data view component on that page now includes the incomplete process that failed validation, which is confusing to the user and not the behaviour I’d expect… If the user instead clicks cancel on validation failure, they’re returned to the same main page but the ‘failed’ process is not shown – following that route it seems to be cleaned up correctly If I log out/change user, the incomplete/failed validation process then disappears. It also disappears if I refresh my browser. It does hang around though if I just continue navigating backwards and forwards between pages. I’ve checked the underlying database, and nothing is committed, so it seems like this is only being remembered temporarily, client-side within the session. I cannot recreate this behaviour for the main entity data view, I’m wondering if it’s related to the fact my 2nd (process) data view uses an Association as a source rather than an entity directly?
The issue occurred because the object is being modified in memory. You have two alternatives:
Use a helper entity on the creation page. After clicking "save" and validating it, copy the attribute values from the helper entity to the actual entity.
Stick with the same entity, but when validation fails, utilize the "rollback" activity.