Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
p:remoteCommand being invoked, but not the action method

I am having some trouble getting a p:remoteCommand to work, it is defined as follows:

<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    template="/template.xhtml" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    <ui:define name="content">
        <h:form id="form" enctype="multipart/form-data" >
            <p:remoteCommand name="connectionTest" action="#{entry.checkConnection}" oncomplete="console.log('BAR');" style="display: none;"/> 
                            
            <p:inputText id="dummy" required="true" value="#{entry.X}" disabled="#{entry.disabled}" />           
            
            <script type="text/javascript"> 
                $(function() {
                    $(document).ready(async function () {
                        console.log('foo');
                        connectionTest();
                    });
                });
            </script>
        </h:form>
    </ui:define>
</ui:composition>

And a bean method in a ViewScoped bean named "entry":

public void checkConnection() {
    ...do stuff
}

The remote command is invoked, as foo and BAR are printed to the console, but the actual bean method checkConnection is not being invoked. I have tried all permutations of action vs actionListener and entry.checkConnection vs entry.checkConnection().

The remoteCommand and script tags are in the same h:form inside a ui:define inside a ui:composition. What am I missing?

Edit: after some trial and error, it seems related to having a required="true" p:inputText on the same form. I have updated my question accordingly. Moving the p:remoteCommand out of the form seems to make it work, but I still am unsure why a p:remoteCommand inside a form with a required p:inputText does not work.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!