Ajax Problems + editor + commandButton
eklam Mar 13, 2009 2:51 PMHello,
I am facing some ajax problems in one especific page...
I am using rich:editor, but it does not render at first itme, when the page is loaded. I am redirecting the user using navigation-rules, the url gets some "wyciwyg://55/" in it's begining.
Also my a4j:commadButton does fire the action method, I've changed it to h:commandButton, now the method is fired, and when the page is reloaded the editor is rendered correctly.
If I access the page directly (typing the url in the address bar) the editor is redered ok.
Thanks in advance,
Eklam
PS: My page code:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jstl/core" xmlns:rich="http://richfaces.org/rich"> <ui:composition template="/site/extras/template.xhtml"> <ui:define name="buscar"></ui:define> <ui:define name="depoimentos"></ui:define> <ui:define name="publicidade"></ui:define> <ui:define name="content"> <script> function conta(txt) { document.getElementById(txt.id+':lblCont').innerHTML = document.getElementById('hdMax').value - txt.value.length; } </script> <input type="hidden" id="hdMax" name="hdMax" value="900" /> <a4j:form ajaxRendered="true" id="frmArquivos" styleClass="form_segmento mright25"> <div class="conteudo" id="middle"> <span class="bverde">Buscar</span> <h:inputText style="width: 200px;"/> <h:commandButton styleClass="inputbtn" value="Ok" action="#{arquivoViagemMB.carregaViagemPre}"/> </div> </a4j:form> <h3 class="titr"><a href="/site/restrita/forum/index.xhtml">Forum</a></h3> <a4j:form id="frm" styleClass="extended"> <div class="form_extended pleft169 clearfix"> <h2><h:outputText value="#{forumTemaMB.novoTopico.tema.titulo}" /></h2> <h5 style="background: #a7a8aa; text-align:center;">Postar uma reposta</h5> <fieldset> <style> dd input {text-align:left!important;} </style> <div class="interior"> <dl class="w575"> <dt> <label>Assunto: </label> </dt> <dd> <h:inputText value="#{forumTemaMB.novoTopico.titulo}" required="true" /> </dd> <dt> <label>Corpo: </label> <br /> <label style="color: #aaa;"> Escreva sua mensagem aqui. <br /><span id="frm:txtMensagem:lblCont">900</span> caracteres restantes. </label> </dt> <dd> <rich:editor id="editor" width="381" height="200" value="#{forumTemaMB.novoTopico.conteudo}" style="float: left; padding-left: 1px; padding-top:5px;"> <a4j:support event="onchange" reRender="result" ajaxSingle="true" requestDelay="1000" /> </rich:editor> </dd> </dl> </div> <div style="text-align: center;"> <a4j:commandButton styleClass="inputbtn" value="Prever" style="width: 100px; margin-top: 8px;" /> <h:commandButton styleClass="inputbtn" action="#{forumTemaMB.salvarPost}" value="Salvar" style="width: 100px;" /> <a4j:commandButton onclick="window.location='/site/restrita/forum/index.xhtml'" styleClass="inputbtn" value="Cancelar" style="width: 100px;" /> </div> </fieldset> </div> </a4j:form> </ui:define> </ui:composition> </html>