You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Gentry <mg...@masslight.net> on 2009/09/01 17:53:38 UTC

Re: Ajax and Validation

Hi Geoffrey (and others),

Did you ever figure out a workaround for this issue?  I have:

  <t:zone t:id="wizard" t:update="show" id="wizard">
    ...
    <t:block t:id="enterEmail">
      <t:form t:id="inputs" t:zone="wizard">
        <h3>Enter E-mail Address</h3>
        <div t:type="Errors"/>

And when I record e-mail address problems in the form, the t:errors
never renders (unless I reload the page as you said).  At this point,
I'll either have to add my own error message presentation or give up
on zones since they don't show the validation errors.

Thanks,

mrg


On Wed, Apr 22, 2009 at 4:38 PM, Geoffrey
Wiseman<ge...@gmail.com> wrote:
> 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/
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org