How do I get to click a link to open a modal panel and run a method to create a new instance of a particular object?
I'm trying to well, but it displays the logo modalPanel and then closes, how can I solve this?
thank you.
Then my code:
<h:commandLink value="#{msg.novo}" actionListener="#{Estado.Novo}"
onclick="Richfaces.showModalPanel('loadEstado')">
My modal Panel
<a4j:form id="frmestadomodal">
<a4j:region renderRegionOnly="false">
<rich:modalPanel id="loadEstado" autosized="true">
<f:facet name="header">
<h:outputLabel value="#{msg.cadastrarestado}"/>
</f:facet>
<f:facet name="controls">
<h:graphicImage value="/images/BOTOES/cancel.png" width="20" height="20"styleClass="imagem"
style="cursor:pointer" onclick="Richfaces.hideModalPanel('loadEstado')" />
</f:facet>
<center>
<h:panelGrid columns="3" width="390">
<h:outputText value="#{msg.codigo}"></h:outputText>
<h:inputText value="#{Estado.estado.estadoid}" id="codigo" disabled="true" styleClass=""></h:inputText>
<h:inputHidden value=""></h:inputHidden>
<h:outputText value="#{msg.estado}"></h:outputText>
<h:inputText value="#{Estado.estado.uf}" id="estado" label="Estado" required="true" size="40" styleClass="" tabindex="1"></h:inputText>
<rich:message for="estado" styleClass="erro" showDetail="false" showSummary="true"></rich:message>
<h:outputText value="#{msg.sigla}"></h:outputText>
<h:inputText value="#{Estado.estado.sigla}" id="sigla" label="Sigla" size="2"
tabindex="2" maxlength="2" required="true">
</h:inputText>
<rich:message for="sigla" styleClass="erro" showDetail="false" showSummary="true">
</rich:message>
</h:panelGrid>
<center>
<a4j:commandButton action="#{Estado.create}" value="#{msg.salvar}"
onclick="Richfaces.hideModalPanel('loadEstado')">
</a4j:commandButton>
<a4j:commandLink value="#{msg.novo}" actionListener="#{Estado.Novo}">
</a4j:commandLink>
</center>
</center>
</rich:modalPanel>
</a4j:region>
</a4j:form>