9

I would like to use partial processing but it does not work in my code. Does anybody knows why?

<h:form id="frmVehicle" prependId="false">
   <p:toolbar styleClass="form_toolbar">   
      <p:toolbarGroup>
        <p:commandButton id="save" process="@(form :not(.noprocess))" ajax="false" value="#{uimsgs.save}" action="#{vmsVehicleActionBean.save()}"
      </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections" orientation="left" styleClass="ses-ui-tabs-left">
      <p:tab title="#{vms_uimsgs['vehicle.tab.data']}">
        <p:panelGrid id="gridHeader" columns="4" columnClasses="form-label,form-input,form-label,form-input" styleClass="form-grid" >
           <p:outputLabel for="kmStatus" value="#{vms_uimsgs['vehicle.kmStatus']}" />
           <p:inputText id="kmStatus" value="#{vmsVehicleActionBean.vehicle.kmStatus}"/>
           <p:outputLabel for="powerKw" value="#{vms_uimsgs['vehicle.power']}" />
           <p:inputText id="powerKw" styleclass="noprocess" value="#{vmsVehicleActionBean.powerKw}">
              <p:ajax event="keyup" update="powerPs" />
           </p:inputText>
           <p:outputLabel value="kw" />
           <p:inputText id="powerPs" styleclass="noprocess" value="#{vmsVehicleActionBean.powerPs}"> 
             <p:ajax event="keyup" update="powerKw" />
           </p:inputText>
           <p:outputLabel value="ps" />
         </p:panelGrid>
       </p:tab>
     </p:tabView>
 </h:form>

The two setters (kw & ps ) are still processed. Any idea?

14
  • You did not mentioned what issue you are getting here? Commented May 17, 2013 at 5:17
  • Oh sorry. My problem is that my setter is always called when i click on my button. I would like to process every textinput except those two (ps &kw). Only the entity should be saved and the setters on the vehicle entity processed.
    – jobe
    Commented May 17, 2013 at 6:24
  • noupdate is not the same as noprocess.
    – BalusC
    Commented May 17, 2013 at 11:50
  • it's working with that: process="@this powerPs powerKw". But as i will have 20 fields, i don't want to name 18. I would like to except 2.
    – jobe
    Commented May 19, 2013 at 21:53
  • 1
    AFAIK, ajax="true" is default, and when you use ajax="false" you can not use partial processing ! Commented May 20, 2013 at 9:11

1 Answer 1

1

Well i created an example thats works for the standard Primefaces showcase. In your page i see something strange. styleclass="noprocess" are you sure you use this? The API says styleClass with a capital C.

Here is an example wich works oke:

<h:form id="form">
    <p:toolbar id="tool">
        <p:toolbarGroup id="group">
            <p:commandButton value="All" ajax="true" id="btnAll" process="@(input:not(.noprocess))" actionListener="#{personBean.savePerson}" />
        </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections">
        <p:tab title="test" id="tab">
            <p:panel header="Partial Process">
                <p:panelGrid id="grid" columns="2">
                    <f:facet name="header">
                        <p:messages />
                    </f:facet>
                    <h:outputLabel for="firstname" value="Firstname:" />
                    <p:inputText id="firstname" value="#{personBean.firstname}" />
                    <h:outputLabel for="surname" value="Surname: *" />
                    <p:inputText id="surname" value="#{personBean.surname}" styleClass="noprocess">                         
                    </p:inputText>
                </p:panelGrid>
            </p:panel>
        </p:tab>
    </p:tabView>
</h:form>

And then bean:

public class PersonBean {  

    private String firstname;  

    private String surname;  

    public String getFirstname() {  
        return firstname;  
    }  
    public void setFirstname(String firstname) {  
        this.firstname = firstname;
        System.out.println("Setted firstname: " +firstname);
    }  

    public String getSurname() {  
        return surname;  
    }  
    public void setSurname(String surname) {  
        this.surname = surname;  
        System.out.println("Setted surname: " +surname);
    }  

    public void savePerson(ActionEvent actionEvent) {  
         System.out.println("Fire action event");

    }  
}
13
  • In my code, when i use process="@(input:not(.noprocess))" and ajax="true" the action is not executed. if i put @(form:not(.noprocess)) it's executed but my inputtext are updated.
    – jobe
    Commented May 21, 2013 at 21:15
  • Did you changed your xhtml to styleClass instead of styleclass?
    – Tankhenk
    Commented May 22, 2013 at 6:13
  • Btw how do you test that your action event is not getting fired?
    – Tankhenk
    Commented May 22, 2013 at 6:52
  • yes, it was already styleClass at the begining, just here was it wrong copied. It test it with a system.err.println in my code.
    – jobe
    Commented May 22, 2013 at 7:26
  • Well strange. My example above works fine here. Maybe there is something wrong in your beans? Maybe you can add them to the question. Just like RongNk says if you set ajax="false" the whole partial submit doesn't work and the whole page is submitted.
    – Tankhenk
    Commented May 22, 2013 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.