We are using velocity expressions to validate the contents of our DS fields. I encountered the case where a 'Nullpointer' is raised from within the velocity expression evaluation. This NullPointer is trapped in our overloaded IDACall servlet where we add the exception into the DSResponse.
This approach causes the UI to display a corrupt error message since a boolean response in expected (FormItem.validate).
Similar to my previous thread, I have the requirement to display our custom error box with the error information.
I am looking for a way to display the error information we send over correctly. As far as I can tell this is only possible if I can overload the FormItem.validate method in some way. I tried to do this by defining the same method on on of our editors which extend the FormItem (trough TextItem) but this seemed to have no effect at all (probably due to native JS functionality).
Do you see a way to override the functionality in that validate method?
I noticed in the debug console that this information is available under the 'clientContext' property in the DSRequest but I can't find a way to access this information.
Alternatively, in case the previous approach is not possible at all, I could manage to create a DS Response which adheres to the expected format, since I got all the information. I tried a few ways to mock the response of a validation call, but the UI never seemed to interpret it correctly (no error was raised, but no validation error was displayed either). Is there some utility or pattern I can use to create a good validation response from scratch and where I can send back a text string which contains the validation error message (in this case the exception details).
Thanks for you insight!
UPDATE:
I did some further investigation and came to the conclusion that I can build a proper validation result if I would be able to access the ValidationContext in our overloaded IDACall servlet (to get the information about which field was validated last and therefore caused the error).
I noticed that this information is available in the 'clientContext' property in the DSRequest when I look in the developer console output, but I can't find a way to access this information.
This approach causes the UI to display a corrupt error message since a boolean response in expected (FormItem.validate).
Similar to my previous thread, I have the requirement to display our custom error box with the error information.
I am looking for a way to display the error information we send over correctly. As far as I can tell this is only possible if I can overload the FormItem.validate method in some way. I tried to do this by defining the same method on on of our editors which extend the FormItem (trough TextItem) but this seemed to have no effect at all (probably due to native JS functionality).
Do you see a way to override the functionality in that validate method?
I noticed in the debug console that this information is available under the 'clientContext' property in the DSRequest but I can't find a way to access this information.
Alternatively, in case the previous approach is not possible at all, I could manage to create a DS Response which adheres to the expected format, since I got all the information. I tried a few ways to mock the response of a validation call, but the UI never seemed to interpret it correctly (no error was raised, but no validation error was displayed either). Is there some utility or pattern I can use to create a good validation response from scratch and where I can send back a text string which contains the validation error message (in this case the exception details).
Thanks for you insight!
UPDATE:
I did some further investigation and came to the conclusion that I can build a proper validation result if I would be able to access the ValidationContext in our overloaded IDACall servlet (to get the information about which field was validated last and therefore caused the error).
I noticed that this information is available in the 'clientContext' property in the DSRequest when I look in the developer console output, but I can't find a way to access this information.
Comment