a4j:support disableDefault property does not work in IE
sdelvalle Jun 9, 2008 2:02 AMHi,
I have the following code snipet
<a4j:form id="planillaForm" ajaxSingle="true" ajaxSubmit="true" focus="estacion"> <h:panelGrid cellpadding="2" cellspacing="0" columnClasses="col1,col2,col3,col4" columns="4" styleClass="mainForm"> <h:outputLabel for="estacion" value="Estacion:"/> <h:inputText id="estacion" label="Estacion" maxlength="4" required="true" size="5" style="margin-right: 20px" value="#{RegistrarPlanilla.estacion}"> <a4j:support action="#{RegistrarPlanilla.findEstacion}" ajaxSingle="true" disableDefault="true" event="onkeyup" onsubmit="if (event.keyCode != 13) return false" reRender="estacionNombre,empleadoPanel"/> </h:inputText> <h:outputText id="estacionNombre" value="#{RegistrarPlanilla.nombreEstacion}"/> <rich:message id="estacionMessage" for="estacion" errorClass="error" infoClass="info" showDetail="false" showSummary="true" warnClass="warn"> <f:facet name="passedMarker"> <h:graphicImage value="images/passed.png"/> </f:facet> <f:facet name="errorMarker"> <h:graphicImage value="images/error.png"/> </f:facet> </rich:message> </h:panelGrid> <a4j:outputPanel id="empleadoPanel" layout="block"> ... <h:panelGroup layout="block" style="margin-top: 20px" rendered="#{SessionBean.estacion != null}"> <h:commandButton id="saveButton" action="#{RegistrarPlanilla.save}" value="Guardar"/> </h:panelGroup> </a4j:outputPanel> </a4j:form>
Everything works fine in FireFox, but when I try the page in IE 7, the first time it works fine, I type the value for estacion and when I press Enter, the empleadoPanel contents are shown, note part of the contents is the saveButton button, if I go and change the value for estacion and press Enter again IE fires the saveButton click event, so I get validation errors from the empleadoPanel panel instead of getting the panel refreshed according to the new value.
I think this is related directly with IE, because the generated code for the inputText estacion, is
<INPUT id=main:planillaForm:estacion onkeyup="if (event.keyCode != 13) return false; A4J.AJAX.Submit('_viewRoot', 'main:planillaForm', event, {'control':this, 'parameters':{'main:planillaForm:j_id27':'main:planillaForm:j_id27', 'ajaxSingle':'main:planillaForm:estacion'} , 'actionUrl':'/akron/main.jsf'} ); return false;" style="MARGIN-RIGHT: 20px" maxLength=4 size=5 value=6614 name=main:planillaForm:estacion>
and it looks just fine for me, anyway hope someone knows how to avoid this behavior.