views:

24

answers:

1

In one of our functionality we have some date fields for inline edit where we have enabled manual input. If in rich:calendar component, we manually enter improper date or junk data it will not even call the action method. As per our requirement we need to display an error message for date validation for these kind of fields. Is there any way to track that the date entered in the calendar field is improper with this component. Code for the reference:

<rich:calendar id="actualOpeningDtCal" rendered="#{!empty aProgram.id}" 
    value="#{aProgram.actualOpeningDate}" placeholder="dd-mmm-yyyy" 
    inputSize="20" enableManualInput="true"  datePattern="dd-MMM-yyyy"  
    buttonIcon="../content/images/calendar.png" showWeeksBar="false"
    showFooter="false">
    <a4j:support event="oninputblur" reRender="aList" ajaxSingle="false" 
        action="#{aController.inlineEdit}"> 
        <f:setPropertyActionListener value="#{aProgram}" 
            target="#{aController.inLineEditaBean}" />
    </a4j:support>      
    <a4j:support event="oncollapse" reRender="aList" ajaxSingle="false"
        action="#{aController.inlineEdit}"> 
        <f:setPropertyActionListener value="#{aProgram}" 
            target="#{aController.inLineEditaBean}" />
    </a4j:support>   
</rich:calendar>   
+1  A: 

If validation fails, then there are error messages. Perhaps you aren't showing them. Use <rich:messages> instead of <h:messages> to have them rendered on ajax response.

A bad practice, but might work, would be to use immediate="true" (bypasses validation) and then do the validation in the action method.

Bozho