3 Replies Latest reply on Oct 28, 2010 6:57 PM by Tim Evers

    Date field Validation

    Palani swamy Newbie

      Hi everyone,
      i have some problem in date field validation,

      Between two-date's like (fromdate and todate),

        • 1. Re: Date field Validation
          Snake Zori Newbie

          Could you be more specific?

          • 2. Re: Date field Validation
            Palani swamy Newbie
            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
            <ui:define name="body">
            <h:form id="productMaster" styleClass="edit" style="width:740px;">
            <f:facet name="header">#{productMasterHome.managed ? 'Edit' : 'Add'}   #{messages.lblProductMasterDetails}</f:facet>
            <td colspan="3">
            <s:decorate id="productAvailableFromField" template="../layout/edit.xhtml">
            <ui:define name="label">
            <h:outputText value="#{messages.lblProductAvailableFrom}"/>
            <rich:calendar id="productAvailableFrom1" required="true" requiredMessage="Plz select From Date" value="#{productMasterHome.instance.productAvailableFrom}"
            datePattern="#{ParamUtil.DATE_PATTERN}" boundaryDatesMode="scroll">
            <a:support event="onchanged" ajaxSingle="true" reRender="productAvailableFrom1,productAvailableFromField"/>
            <ui:define name="label">
            <h:outputText value="#{messages.lblProductAvailableTo}"/>
            <rich:calendar id="productAvailableTo1"  required="true" requiredMessage="Plz select To Date"
            dayStyleClass="disabledClassesProv" value="#{productMasterHome.instance.productAvailableTo}"
            datePattern="#{ParamUtil.DATE_PATTERN}" boundaryDatesMode="scroll">
            <a:support event="onchanged" ajaxSingle="true" reRender="productAvailableTo1"/>

            If i select fromdate(ex 25-10-2010)from calendar control, the ToDate Calendar Control Should be Display greater than from date (ex : >25-10-2010).

            I need a suggession for the above issue.

            Thanks in advance.
            • 3. Re: Date field Validation
              Tim Evers Master

              That is where you solve the problem. Whatever method the productAvailableTol is calling to get it's data is probably a fine spot to validate the dates. It's not the best way of doing things but it will work well enough.

              JSF 1.2 doesn't really support dependent validation between components. (It can/has been done but it's not a simple task. If you are really keen on trying then search these forums there are some examples here somewhere).

              JSF 2.0 adds dependent validation I think.