Joe writes:Otherwise, Paul, I'm not sure what you mean... is your idea that anXMLHttpRequest call would be made to do server-side validation for each form update? The overhead is likely to make that an impractical solution. Or are you wondering how errors would be reported back to the page as a response from an XMLHttpRequest?
I am not quite sure why "the overhead makes it impractical," unless there is a physical barrier such as bandwidth restraint -- but that sounds like a case-by-case decision is required.
Well, by definition, an XMLHttpRequest involves a request/response. I suppose it's true that a blanket statement against is in appropriate, considering that things like Google Maps do lots of XML R/R every time you drag the map around.
But I've seen some forms, which I think AJAX runs behind the scenes to do validation. (If I can re-find a link I will send it.) When a non-date field is entered into a date field, for instance, an error message is shown to its side. This client-side reporting is akin to the errorStyles, which were added to the Struts 1.2.5 tags to allow per-field reporting on the server-side.
It seems like validating a date is particularly a case where JavaScript should be able to do it fine without a network call -- unless you want to have some kind of scheduler app which checks to see if a date is "available" or something.
Now, you raise a good point as to how the Javascript could capitalize on the presence of the errorStyle attribute, which normally is only interpreted on page load. That is, if you did any client side validation, you'd probably like to be able to switch the style of the invalid field to whatever was specified in "errorStyle" even if there was no error when the page loaded. This is valuable outside of the specifics of an Ajax situation and would also apply to any client-side validation. Unfortunately, I'm having trouble seeing a particularly clean way to do it which wouldn't involve loading down the base tags (because of single inheritance) and even then, I think you'd have a pretty contentious time getting people to agree on what the base tags should output. I guess maybe you could have some Application scoped "input tag decorator" which could be invoked by the tag if present while still leaving things open for customization...
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]