Hello all,

I'm seing some interesting behavior I hope you can help me sort out.

I have a form which I would like to display an error message (custom) should
the form validation fail.  I'd like to do this via AJAX since the contents
of the form are created via AJAX and refreshing the page to display this
error message will lose this context.

So, I have something like this:

<t:zone t:id="nothingSelectedZone" id="nothingSelectedZone"
visible="${errorVisible}">
  No items have been selected.
</t:zone>

<t:zone t:id="resultsZone" id="resultsZone" visible="${resultsVisible}">
  <form t:id="parts" t:zone="nothingSelectedZone">
    <input type="button" t:type="submit" value="Do It"/>
  </form>
</t:zone>

void onValidateFormFromParts()
{
  if (isValid())
  {
    _parts.recordError("No items selected.");
  }
  else
  {
    _parts.clearErrors();
  }
  errorVisible = _parts.getHasErrors();
}

Object onSuccessFromParts()
{
  return otherPage;
}

Object onFailureFromParts()
{
  return nothingSelectedZone.getBody();
}

If there's no error with validation, the success method gets called fine,
and I am redirected to the otherPage.
If there is an error with validation, the nothingSelectedZone is updated and
the error message is displayed.
However, if, after a validation error I try to re-submit the form, nothing
happens at all.  I've put breakpoints in my debugger on these three methods
and they don't get hit in this case.  It's as if the form submit is not
taking place after the initial validation error.

I'd love some input.

Thanks,

Levi

-- 
View this message in context: 
http://n2.nabble.com/T5-1-AJAX-Form-Validation-tp3753039p3753039.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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

Reply via email to