[MAGNOLIA-2916] Add the possibility to set a validation class for controls. Created: 29/Oct/09 Updated: 04/Oct/10 Resolved: 04/Oct/10 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core, gui |
| Affects Version/s: | 4.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Danilo Ghirardelli | Assignee: | Philipp Bärfuss |
| Resolution: | Not an issue | Votes: | 0 |
| Labels: | dialog, validation | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: |
| Description |
|
Sometimes there is the need of validating a dialog element (control) with more logic than the "required" and regular expressions only. I'm thinking about email fields, of even a check for image dimensions or colours in the image control. It would be really nice to have che possibility to set a property in the control configuration with (for instance) "validationClass" and a class that extends some interface. Usually I do something similar extending the control I want to validate, but it should be quicker if this behaviour is in the common parent for all controls. |
| Comments |
| Comment by Jan Haderka [ 29/Oct/09 ] |
|
Actually for simple regexp based validation you can use validationPattern nodeData in the dialog controls as described at http://wiki.magnolia-cms.com/display/WIKI/Controls+overview |
| Comment by Danilo Ghirardelli [ 29/Oct/09 ] |
|
Yes, I know there is the regular expression validator. The improvement is to go beyond that, having a custom class. |
| Comment by Jan Haderka [ 29/Oct/09 ] |
|
Since you already rewrote this few times .... do you think you can extract one of the "rewrites" into a patch that could be applied to do this? The patch would definitively increase chances of this feature getting into the next release. |
| Comment by Danilo Ghirardelli [ 04/Oct/10 ] |
|
You can close this issue, it's obsolete and just wrong. There is already a built-in undocumented feature in Magnolia that does exactly this: it is possible to declare a SaveHandler for the control and have it implement the ValidatingSaveHandler interface. Extending the control's original saveHandler the only thing left is just implementing the validate() method, which is exactly what was requested in this issue. |