2

The entered input values reset upon manually selecting the values of selectOneMenu id="format"

The render of selectOneMenu id="format" works fine. But upon selection of the drop down values of selectOneMenu id="format" the entered field input values are blank.

Page

Employee name[Mark]         Employee Type       [New]       

Format [Select some drop down value]
.

Current Output

Employee name[Entered Value Disappeared/null]           Employee Type       [Selected value disappeared/null]       

Format [Selected some drop down value]

Expected Output

Employee name[Mark]         Employee Type       [New]       

Format [Selected Value]
.

I have tried to add

                <p:ajax event="valueChange" immediate="true" process="@form" />
                The rendering fails if I add it for the selectOneMenu

I have the code below

main.xhtml

    <h:form id="newFormBank" enctype="multipart/form-data">   
    <h:panelGroup id="id">
    <p:growl id="growl" sticky="true" showDetail="true" />
    <p:wizard id="newBankWizard" showNavBar="true" widgetVar="bankWiz" flowListener="#{javaMB.wizardFlow}">
        
        <p:tab id="pro" title="Banks">
                <ui:include src="/jsf/xyz.xhtml" />                      
                <ui:include src="/jsf/employeeloan.xhtml" />                
                            
        </p:tab>
        </p:wizard> 
    </h:panelGroup>
    </h:form>

employeeloan.xhtml

<p:panel id="employeeLoan" styleClass="panelNoBorder">             
        <div class="ui-g">  <div class="ui-g-1"><p:outputLabel value="Employee Name" /></div>
                <div class="ui-g-3">    <p:row>        <p:inputText id="employeeName" maxlength="50" style="width: 65%;" value="#{javaMB.visaDetailsEntity.employeeName}"   >    </p:inputText> </p:row>    </div>
                <div class="ui-g-1"><p:outputLabel value="Employee Type" /></div>
                <div class="ui-g-3">
            <p:row>    <p:selectOneMenu id="employeeTypeList" value="#{javaMB.visaDetailsEntity.employeeTypeCode}" >    
                    <f:selectItem itemLabel="Select Release Type" itemValue=""> </f:selectItem>
                    <f:selectItem itemLabel="New" itemValue="1"  />
                    <f:selectItem itemLabel="Existing" itemValue="2"  />        </p:selectOneMenu> </p:row>     </div>            </div>
                <div class="ui-g">   <div class="ui-g-1"><p:outputLabel value="CREDIT" /></div>
            <div class="ui-g-3">
            <p:row>                
                <p:selectOneMenu id="format" value="javaMB.visaDetailsEntity.visaType.visaId">
                    <f:selectItem itemLabel="VISA" itemValue="1"  />
                    <f:selectItem itemLabel="MASTER CARD" itemValue="2"  />
                    <f:selectItem itemLabel="DISCOVER" itemValue="3"  />
                    <f:selectItem itemLabel="AMERICAN EXPRESS" itemValue="4"  />
                    <f:ajax render="@form" />                      
                </p:selectOneMenu>
            </p:row>
            </div>     
        </div>            
                    
        <div class="ui-g">
            <div class="ui-g-1"><p:outputLabel value="VISA" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '1'}"/></div>
            <div class="ui-g-3">     <p:row>
            <p:inputText id="visaeg" maxlength="9" size="30" value="#{javaMB.visaDetailsEntity.malaustin}"  label="VISA1" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '1'}"> 
            </p:inputText>
            </p:row>
            </div>
            <div class="ui-g-1"><p:outputLabel value="VISA" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '1'}"/></div>
            <div class="ui-g-3">
            <p:row>
            <p:inputText id="visaegg" maxlength="11" size="30" value="#{javaMB.visaDetailsEntity.malecinyc}" label="VISA2" onchange="negateLongitude()" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '1'}">
            </p:inputText>
            </p:row>
            </div>
        </div>                        
        
        <div class="ui-g">
            <div class="ui-g-1"><h:outputLabel  value="MASTER CARD" style="overflow: hidden" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '3'}"/></div>
            <div class="ui-g-3">
            <p:row>        
            <p:inputText id="masterd" maxlength="7" size="30" value="#{javaMB.visaDetailsEntity.atepmo}" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '3'}">
            </p:inputText>
            </p:row>
            </div>
            <div class="ui-g-1"><h:outputLabel for="masterdt" value="MASTER CARD DETAILS" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '3'}"/></div>
            <div class="ui-g-3">
            <p:row>
                    
            <p:inputText id="datilsmast" maxlength="8" size="30" value="#{javaMB.visaDetailsEntity.atepllanyc}" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '3'}">
            </p:inputText>
            
            </p:row> 
            </div>                   
        </div>

        <div class="ui-g">

            <div class="ui-g-1"><h:outputLabel  value="DISCOVER" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '4'}"/></div>
            <div class="ui-g-3">
            <p:row>

            <p:inputText id="ltdiscover" maxlength="2" size="30" value="#{javaMB.visaDetailsEntity.egrssfo}"  rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '4'}">            
            </p:inputText>
            
            </p:row>
            </div>
            <div class="ui-g-1"><h:outputLabel  value="DISCOVER Details" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '4'}"/></div>
            <div class="ui-g-3">
            <p:row>
                    
            <p:inputText id="lodiscover" maxlength="4" size="30" value="#{javaMB.visaDetailsEntity.eongtx}"  rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '4'}">
            </p:inputText>
            
            </p:row> 
            </div>                   
        </div>


        <div class="ui-g">

            <div class="ui-g-1"><h:outputLabel  value="AExp AZ" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '2'}"/></div>
            <div class="ui-g-3">
            <p:row>

            <p:inputText id="azaexp" maxlength="2" size="30" value="#{javaMB.visaDetailsEntity.aexpaz}"   rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '2'}">     
            </p:inputText>  
            
            </p:row>
            </div>
            <div class="ui-g-1"><h:outputLabel  value="AExp FL" rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '2'}"/></div>
            <div class="ui-g-3">
            <p:row>
                    
            <p:inputText  id="flaexp" maxlength="4" size="30" value="#{fvLocationMB.coordinateForm.aexpazfl}"  rendered="#{javaMB.visaDetailsEntity.visaType.visaId == '2'}">  
            </p:inputText>
                            
            </p:row> 
            </div>                   
        </div>
              
        </div>            
       </p:fieldset>
    </p:panel>
   </ui:composition>

javaMB getters setters Entity getters setters

narli
  • 41
  • 2

1 Answers1

0

Your p:ajax statement is wrong, it should probably read something like:

<p:ajax event="valueChange" update="@form" />

Find an exhaustive explanation of the inner workings here:

Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes

Torsten
  • 5,831
  • 1
  • 31
  • 29