You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alex Reid <al...@phiz.biz> on 2004/10/06 01:05:34 UTC

Validation and Stuck Forms

Hi

I've been using Tapestry for about a week now. Really enjoying it.

However one thing has got me stumped. I'm attempting to validate a field
using StringValidator.

It appears the validator is doing its job. The setter method is correctly
not being called when an invalid value is submitted. The form is displayed
with ** next to the offending field - so far so good.

However when a valid value is entered upon the second time, setXXX IS
called as it should be and the value is updated. BUT it seems that the
form page is still 'stuck'.
The same form is redisplayed along with the validation error messages -
even though the values are now valid.

delegate.getHasErrors() is still returning true and
delegate.getFirstError()   contains the same error.

When a valid value is entered first time around, everything is fine.

Listener method below.

Hope this makes sense as it's rather late here!
I'd be very grateful of any pointers.

Alex

	public void saveOrganisation(IRequestCycle cycle) {
		System.out.println("saveOrganisation fired");

		ValidationDelegate delegate = (ValidationDelegate)
			getBeans().getBean("delegate");

		// if we have no errors, save. otherwise redisplay
		if(!delegate.getHasErrors()) {
			Visit visit = (Visit)cycle.getEngine().getVisit();
			visit.saveCurrentOrganisation();
			cycle.activate("OrgEditSuccess");
		}
	}

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