Limitations of AJAX validation

Feb 10, 2012 at 6:37 AM

Hi there.

I have a string property on a entity that gets rendered as a multi-line text box.

I have a ValidateXXX method for that property. When I have more than around 2000 chars in that text box, the AJAX validation call fails with a Bad Request message. This is most probably because a GET Request is limited to about 2000 chars, if I remember right. Or is that 2000 KB? I don't know. :)

Either way, it would be nice to still have that validation on the server side, even if it can't work with AJAX. But I don't believe there is a way of turning off AJAX validation just for 1 property, is there?

Feb 10, 2012 at 9:07 AM

According to the manual:

"When running a Naked Objects MVC application using the Ajax functionality, Validate methods will normally be called on the server as soon as the user moves away from the field (for example by tabbing). If the Validate method contains very complex logic, then this could result in a significant performance overhead. Server-side validation using Ajax may therefore be suppressed on a field-by-field basis, by adding the attribute [Executed(Ajax.Disabled)]."

I have to say that neither Stef nor I have any memory of ever having used this attribute.  The motivation for it seems to be slightly different to your case  -  but it might still do the job.  Worth a try, anyway.

Feb 10, 2012 at 9:53 AM
I'll give that a shot.
Sorry. I did not realize it was now possible to do that. I remember it
wasn't originally possible.

Thank you much.
Feb 10, 2012 at 5:11 PM
Mm. Ok, that did not work.
I tried putting that attribute both on the property itself, and also on the ValidateProperty() method.
In both cases the AJAX validation is still firing for that property.