Problema com submit

0 respostas
barcellosrod

Boa tarde galera;

Estou com com o seguinte problema:

Referente a página atual:

Estou em uma pagina que contem um bean próprío dela;

Nesta mesma página tenho um include de um rich:modalPanel no final e fora dor form da página;

Tenho um link que chama o modalPanel.
Referente ao modal panel:

Tem seu próprio form;

Tem seu próprio bean;

Quando chamo o modal, e clico para salvar alguma coisa nele, ele executa antes o construtor do bean, que acaba por inicializar todas as variaveis que deveriam sem submetidas, mesmo a página ja estando aberta, que acaba por sua vez tentando salvar todos os campos vazios…

Segue fonte:
Página de veiculos que vai chamar o panel

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 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:t="http://myfaces.apache.org/tomahawk"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">

	<head>
		<a4j:loadStyle src="../css/generic.css"></a4j:loadStyle> 	
	</head>	
		<a4j:form id="main" ajaxSubmit="false" >									
			<t:panelGrid columns="1" style="text-align:center;">
				<rich:panel style=" width : 300px;" headerClass="header" bodyClass="corpo">
					<f:facet name="header">
						<h:outputText value="Grupos de Veículos" />
					</f:facet>								
					<t:panelGrid columns="2" style="text-align:left;">
						<t:panelGroup colspan="2">
							<h:outputText id="lblempresa" value="Empresa (matrizes)" styleClass="label"/>
						</t:panelGroup>
						<t:panelGroup colspan="2">
							<h:selectOneMenu id="cmbempresa" value="#{vehicleGroupBean.group.branchId}" styleClass="campo_obrigatorio_200">
					        	<f:selectItem itemValue="-1" itemLabel="Selecione um item"/>
					        	<f:selectItems value="#{vehicleGroupBean.comboCustomers}"/>									        	
					        		<a4j:support ajaxSingle="true" event="onchange" immediate="true" reRender="cmbgroup" action="#{vehicleGroupBean.loadGroups}"/>									        	
					        </h:selectOneMenu>
					    </t:panelGroup>
				        <t:panelGroup colspan="2">
							<h:outputText id="lblgrupos" value="Grupos" styleClass="label"/>
						</t:panelGroup>
						<t:panelGroup colspan="2" style="text-align:right;">
							<h:selectOneMenu id="cmbgroup" value="#{vehicleGroupBean.group.groupId}" styleClass="campo_obrigatorio_200">
				        		<f:selectItem itemValue="-1" itemLabel="Selecione um item"/>
				        		<f:selectItems value="#{vehicleGroupBean.groups}"/>									        	
				        	</h:selectOneMenu>
				        </t:panelGroup>													    							      
					</t:panelGrid>
				</rich:panel>							 
			</t:panelGrid>
			<a4j:commandLink value="Cadastrar Novo Grupo" ajaxSingle="true" id="showpopup" oncomplete="#{rich:component('modal:editPanel')}.show()"/>
		</a4j:form>	
	<ui:include src="../pages/cad_group.xhtml" />
</ui:composition>

Página que contem o modal

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition 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:t="http://myfaces.apache.org/tomahawk"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
         
     	<head>
			<a4j:loadStyle src="../css/generic.css"></a4j:loadStyle> 	
		</head>	
                   
	   	<a4j:form id="modal" ajaxSubmit="false">		
			<rich:modalPanel id="editPanel" autosized="true" width="240" zindex="2000">
		        <f:facet name="header">
		            <h:outputText value="Cadastro de Grupos" />
		        </f:facet>
		        <f:facet name="controls">	           
		            <h:commandLink value="X" id="hidelink"/>
		        	<rich:componentControl for="editPanel" attachTo="hidelink" operation="hide" event="onclick" />	               	           
		        </f:facet>		       	            
	            <t:panelGrid>
	            	<t:panelGrid columns="2" style="text-align:left;">
						<t:panelGroup colspan="2">
							<h:outputText id="lblempresa" value="Empresa (matrizes)" styleClass="label"/>
						</t:panelGroup>
						<t:panelGroup colspan="2">
							<h:selectOneMenu id="cmbempresa2" value="#{groupBean.group.branchId}" styleClass="campo_obrigatorio_200">
					        	<f:selectItem itemValue="-1" itemLabel="Selecione um item"/>
					        	<f:selectItems value="#{groupBean.comboCustomers}"/>									        						        									        
					        </h:selectOneMenu>
					    </t:panelGroup>
				        <t:panelGroup colspan="2">
							<h:outputText id="lblgrupo" value="Grupo" styleClass="label"/>
						</t:panelGroup>
						<t:panelGroup colspan="2" style="text-align:right;">
							<h:inputText id="txtgroup" value="#{groupBean.group.groupName}" styleClass="campo_obrigatorio_200"/>			        		
				        </t:panelGroup>
				        <t:panelGroup colspan="2">
							<h:outputText id="lblcores" value="Cores" styleClass="label"/>
						</t:panelGroup>
						<t:panelGroup colspan="2">
							<h:selectOneMenu id="cmbcolours" value="#{groupBean.group.colour.id}" styleClass="campo_obrigatorio_200">
					        	<f:selectItem itemValue="-1" itemLabel="Selecione uma cor"/>
					        	<f:selectItems value="#{groupBean.comboColours}"/>									        					        										        
					        </h:selectOneMenu>
					    </t:panelGroup>													    							      
					</t:panelGrid>
	            	<t:panelGroup colspan="2" style="text-align:right;">	  
		                <a4j:commandButton value="Cancelar"  
		                	action="#{groupBean.cancelInsertGroup}"	                  
		                    oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();" 
		                    reRender="cmbempresa, cmbgroup" />	                      
		                <a4j:commandButton value="Salvar"
		                    action="#{groupBean.insertGroup}"
		                    reRender="cmbempresa, cmbgroup"
		                    oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();"/>
	                </t:panelGroup>
	            </t:panelGrid>			     
		    </rich:modalPanel>	
	    </a4j:form>		
</ui:composition>
Criado 8 de abril de 2010
Respostas 0
Participantes 1