I have a scenario where I am using a slideshow to simulate a wizard through which the user inputs data. Each slide represents a different section of data. The user clicks "next" through the various slides then on the last slide clicks submit. At this point all of the datasets are validated and saved.
But what I really want is for none of the data to be saved if there is an error in any of the datasets.
The scenario is this. At present, if dataset1 validates as its ok, and dataset2 has an error, dataset1 will be persisted and the form will be cleared. What I would like is for some pre-validation before saving, so if dataset2 contains invalid data, no data is saved even if dataset1 is fine.
So in summary, validation currently occurs in the dataset.save() method. What alternative approach could I use to validating the dataset without persisting it? I've looked at using data hooks but don't see how they can help we pre-validation.
I am currently using the dataset.onerror() method to show errors to users.