tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Lewis" <br...@maine.rr.com>
Subject Do I really need to clear the validationDelegate?
Date Sun, 17 Aug 2003 15:10:08 GMT
I have a simple form including a date field, a ValidField.
(Page specification shown below.)

It starts out fine... if the user enters a date with a syntax error, we stay
on the same page.  The user sees the red asterisks, corrects the data
and re-submits.  The problem is, the page remembers the previous error...
delegate.getHasErrors() still returns true.

I've worked around the problem by doing delegate.clear() in detach(),
but that doesn't feel right.  I've searched the list, source, and docs, and
nobody else seems to need that... I suspect I'm missing something.

    .page:
        <bean name="delegate"
class="org.apache.tapestry.valid.ValidationDelegate"/>

        <bean name="dateValidator"
class="org.apache.tapestry.valid.DateValidator">
            <set-property name="required" expression="false"/>
            <set-property name="maximum" expression="new java.util.Date()"/>
        </bean>

        <component id="dateField" type="ValidField">
            <binding name="value" expression="data.lastPasswordDate"/>
            <binding name="validator" expression="beans.dateValidator"/>
        </component>

    .java:
        public void detach()
        {
            validationDelegate.clear();    // forget previous error
            super.detach();
        }



Mime
View raw message