0 Replies Latest reply on Jan 20, 2010 4:09 PM by asookazian

    how to display validation error for component in dataTable?

    asookazian

      The following rich:calendar is in a rich:dataTable.

       

      <rich:calendar  id="existingRateCategoryEffectiveDate"
                                                  inputClass="dateField"
                                                  disabled="#{pageaction == 'view'}"
                                                  required="true"
                                                  value="#{rateCategory.rateCategory.priceEffectiveDate}"
                                                  oninputkeypress="return restrictDate(this, event);"                                           
                                                  datePattern="MM/dd/yyyy"
                                                  enableManualInput="true"        
                                                  isDayEnabled="isDayEnabled"
                                                  dayStyleClass="getDisabledStyle"                  
                                                  label="#{messages['/restricted/billing/add_merchant_billing_group_wizard_step1.xhtml/field.effectiveDate']}">
                                          <a4j:support event="oninputblur"
                                                       action="#{merchantBillingGroupEditorUI.validExistingEffectiveDates(rateCategory.getRateCategory().getPriceEffectiveDate())}"
                                                       ajaxSingle="true"
                                                       reRender="existingRateCategoryEffectiveDate"
                                                       requestDelay="0"
                                                       eventsQueue="select"
                                                       ignoreDupResponses="true"
                                                       onsubmit="showProgress();"
                                                       oncomplete="hideProgress();"/>
                                  </rich:calendar>

       

      I have validation logic in a Seam backing bean component which is executing but not showing the error msg after the page is reRendered.  I see this in console:

       

      12:58:27,482 INFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=merchantBillingWizardForm:j_id202:j_id1206:j_id1275:existingRateCategoryEffectiveDate[severity=(WARN 1), summary=(1/15/09 12:00 AM is a date in the past.  Please enter today's date or a future date.), detail=(1/15/09 12:00 AM is a date in the past.  Please enter today's date or a future date.)]

       

      Here is the validation method:

       

         
          public boolean validExistingEffectiveDates(Date effectiveDate) {
              //do not allow past dates unless it's a previously saved (cached) date
             
              boolean valid = true;
              Date today = new Date();
             
              if (effectiveDate != null) {
                  if (effectiveDate.before(today)) {
                      facesMessages.addToControlFromResourceBundleOrDefault(
                              "existingRateCategoryEffectiveDate", FacesMessage.SEVERITY_WARN,
                              "MerchantBillingGroupEditorUIBean.past.effectiveDate",
                              "{0} is a date in the past.  Please enter today's date or a future date.",
                              effectiveDate);
                      valid = false;
                  }
              }
              return valid;
          }

       

      So the id is 'existingRateCategoryEffectiveDate' but there are several rich:calendar components with that id in the dataTable.  How to solve this so the error will be attached to the appropriate calendar control after reRender?