richfaces - Disable button and show loading image while processing JSF -
i have module in webapp need update come catalogs.
the idea disable h:commandbutton , show h:graphicimage, both actions supposed happen right after button clicked. finally, when update process has ended should other way, hide h:graphicimage, enable h:commandbutton time show label h:outputtext says either 'update success' or 'update failure'.
the problem in code image , label appear right after process finished , can't find way described above.
where or missing?,
cheers.
<a4j:commandbutton id="btnactualiza" value="actualizar catálogos" render="messagecatalogos actualizacioncorrecta @this imgprocesando" onclick="this.disabled=true;" oncomplete="this.disabled=false" actionlistener="#{administrationbean.doimgprocesandovisible}" action="#{administrationbean.doactualizacatalogos}"/> <a4j:outputpanel id="imgprocesando"> <h:graphicimage rendered="#{administrationbean.imgprocesandorendered}" url="img/imgloading.gif"/> </a4j:outputpanel> <h:panelgroup/> <h:panelgroup/> <a4j:outputpanel id="actualizacioncorrecta" style="font-size: 14px; color: #d17100"> <h:outputtext rendered="#{administrationbean.actualizacioncorrectalabelrendered}" value="actualización correcta !"/> <h:outputtext rendered="#{administrationbean.actualizacionfallolabelrendered}" value="fallo la actualización !"/> </a4j:outputpanel> update
my dev environment:
- mojarra 2.1.6
- richfaces 4.1.0.final
- tomcat 7.0.14(test) / tomcat 7.0.22(prod)
you need show , hide image js instead.
<h:graphicimage id="loading" url="img/imgloading.gif" style="display:none" /> with
<a4j:commandbutton ... onbegin="this.disabled=true; $('#formid\\:loading').show()" oncomplete="this.disabled=false; $('#formid\\:loading').hide()" />
Comments
Post a Comment