You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by david joffrin <da...@hotmail.com> on 2005/04/20 18:55:41 UTC

Date formatting validation "strange" behavior - Reposting

OK, so I have the following:

.page:
    <bean name="dateValidator"
class="org.apache.tapestry.valid.DateValidator">
        <set-property name="required" expression="false"/>
        <set-property name="format"
expression="@com.etil.sudetp.presentation.utils.Display@DATEFORMAT"/>
        <set-property name="invalidDateFormatMessage"
expression="@com.etil.sudetp.presentation.ErrorIds@INVALID_DATE"/>
    </bean>
	<component id="validity" type="ValidField">
		<binding name="value" expression="validity"/>
        <binding name="validator" expression="beans.dateValidator"/>
        <static-binding name="displayName" value="Validity:"/>
	</component>

.html:
<tr>
  <td bgcolor="#EAEAF7"></td>
  <td bgcolor="#EAEAF7">
    <b><span jwcid="@FieldLabel"
field="ognl:components.validity">Validity:</span></b><br/>
    <small>(dd/mm/yyyy)</small>
  </td>
  <td><input jwcid="validity" type="text" size="10"/></td>
</tr>

.java:
        IValidationDelegate delegate = getValidationDelegate();

        // There were some UI validation errors!
        if (delegate.getHasErrors())
            return;

public class Display {
    public static final DateFormat DATEFORMAT = new
SimpleDateFormat("dd/MM/yyyy");
}


If I enter a date like 04/28/1990.... no validation is happening and
my date is transformed to 04/04/1992!!!
What shall I do to implement this validation dd/mm/yyyy.

Thanks.
David



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