3 Replies Latest reply on Jun 21, 2012 5:42 PM by Ernesto Hernandez

    setting focus back to current input control after validation error

    Arbi Sookazian Master

      How do I set the focus back to current input control after validation error?  I know there is a focus attribute for the rich:calendar control but I only want the focus set back in the control if there is a validation error, not always (i.e. allow user to tab thru the control when there is no validation error).  I thought the focus would auto-set to current control by default when there is a validation error...

       

      <echo:decorate>
                          <rich:calendar id="newRateCategoryEffectiveDate"
                              inputClass="dateField"
                              required="false"
                              value="#{merchantBillingGroupEditorUI.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.validNewEffectiveDate()}"
                                              ajaxSingle="true"
                                              reRender="newRateCategoryEffectiveDate"
                                           requestDelay="0"
                                           eventsQueue="select"
                                           ignoreDupResponses="true"
                                           onsubmit="showProgress();"
                                           oncomplete="hideProgress();"/>
                          </rich:calendar>
                      </echo:decorate>