What's the acceptable amount of times to repeat the same piece of code before we decide to encapsulate the behaviour into something reusable?
A while ago I posted a solution to this using a custom view result.
The idea of creating validators is make them reusable between several models.
A validator can also be as simple as: Phalcon\Mvc\Model has a messaging subsystem that provides a flexible way to output or store the validation messages generated during the insert/update processes.
One possible reason for this is that Model State is not persisted between requests.
It can be, but you need to copy it somewhere more permanent.
I have used the same code but have programmed the edit template to show in modal-popup(bootstrap).
As soon as there are validation errors, the screen changes from popup to normal window.
You're probably already doing this when your POST is successful, but we've been encourage NOT to do it when Model State validation fails.
A Visual Studio project with source code is available to accompany this topic: Download.
The following illustration shows error messages that are automatically displayed in a browser when client-side validation fails.
For example, the following code will always display a client side validation error, even when the date is in the specified range: You will need to disable j Query date validation to use the Range attribute with Date Time.
It's generally not a good practice to compile hard dates in your models, so using the Range attribute and Date Time is discouraged.
Is there a way to show the errors in modal-popup only.