I wasn't sure if Tapestry did any magic under the covers to work with
server-side validation and ajax form submits.  I did a quick experiment and
it doesn't seem to:

   - Create a form, give it a zone to do ajax submit.
   - Create an onValidateForm method, throw a ValidationException from it.
   - Load up the application.  Submit the form.
   - The zone gets updated, no validation messages appear.

No big surprises so far -- this is Ajax form submits and the fact that
validation isn't meant to work with it, near as I can tell.  The next part,
however, worries me a little:

   - Refresh the page, or go the same URL.
   - The page renders as if you'd just submitted the form.  The field is
   populated an there's a visible error block.
   - I don't have any Persist annotations here or anything, so I'm a little
   disturbed that it's retaining a form value and validation state despite
   that.

Am I missing something, or is this some kind of ugly edge case around ajax
and form validation?

Now you could argue that ajax form submits and validation don't belong
together, which I might agree with.  I'd have to understand how Tapestry
handles graceful degradation in order to argue the point.

On a side note, I'd love to be able to throw a t:errors outside of a form in
a block and point it /to/ the form to use that to display validation
errors.  (e.g. <t:block t:id="errors"><t:errors t:form="save" /></t:block>)

  - Geoffrey
-- 
Geoffrey Wiseman
http://www.geoffreywiseman.ca/

Reply via email to