Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8572499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:01:33+00:00 2026-06-11T19:01:33+00:00

I have an <p:inputText value=#{beans.text} /> and a <p:commandButton actionlistener=#{beans.method} /> . How can

  • 0

I have an <p:inputText value="#{beans.text}" /> and a <p:commandButton actionlistener="#{beans.method}" />.
How can I execute the actinoListener-Method from Button by ‘enter’ in the inputText??

Thanks for answers

somthing went wrong. Here is the code-snippet->

<h:panelGrid columns="2">
<p:commandButton actionListener="#{hoursView.saveOrUpdateHour}" />
<p:commandButton actionListener="#{hoursView.onFilterChange()}" oncomplete="dlgHoursFilter.show()" immediate="true" update=":hoursFilter" />
</h:panelGrid>
</h:panelGrid>
<h:panelGrid columns="4" class="buttonContent" id="buttonView">
<p:commandButton ajax="false" actionListener="#{hoursView.showDay()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showWeek()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showMonth()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showAll()}" immediate="true" update="hoursList" />
</h:panelGrid>
         <h:panelGrid columns="3" id="tableGrid">
            <p:dataTable id="hoursList" value="#{hoursView.listHours}"
                var="hours" widgetVar="hoursTable" resizableColumns="true"
                emptyMessage="#{msg.noData}" rowKey="#{hours.id}"
                selection="#{hoursView.selected}" selectionMode="single">

                <p:ajax event="rowDblselect" update=":hourEditDialog"
                    listener="#{hoursView.onHourSelect}"
                    oncomplete="dlgHourEdit.show()" />

                <f:facet name="header">
                    <h:panelGrid columns="3" class="buttonContent" id="regexContent">
                        <h:outputText value="#{msg.regexHour}" />
                        <p:inputText value="#{hoursView.regex}" id="regex">
                        </p:inputText>
                        <p:commandButton icon="addButton" id="regexSave"
                            process="regexContent" actionListener="#{hoursView.regexSave}"
                            update=":editContent:hoursList,:editContent:growl,regex">
                            <p:defaultCommand target="regexSave" scope="regexContent" />
                        </p:commandButton>
                        <p:tooltip for="regexSave" value="#{msg.regexSave}"
                            showEffect="fade" hideEffect="fade" />
                    </h:panelGrid>
                </f:facet>

If I fire ‘enter’-event the regexSave-Method will be actioned. But the Method for saveOrUpdateHour,too….


somthing went wrong. Here is the code-snippet->

<h:panelGrid columns="2">
<p:commandButton actionListener="#{hoursView.saveOrUpdateHour}" />
<p:commandButton actionListener="#{hoursView.onFilterChange()}" oncomplete="dlgHoursFilter.show()" immediate="true" update=":hoursFilter" />
</h:panelGrid>
</h:panelGrid>
<h:panelGrid columns="4" class="buttonContent" id="buttonView">
<p:commandButton ajax="false" actionListener="#{hoursView.showDay()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showWeek()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showMonth()}" immediate="true" update="hoursList" />
<p:commandButton  ajax="false" actionListener="#{hoursView.showAll()}" immediate="true" update="hoursList" />
</h:panelGrid>
<h:panelGrid columns="3">
<h:outputText value="#{msg.regexHour}" />
<p:inputText value="#{hoursView.regex}" id="regex">
<p:ajax event="change" update="hoursList, growl" listener="#{hoursView.regexSave}" />
</p:inputText>
<p:commandButton  actionListener="#{hoursView.regexSave}" update="hoursList, growl" />
</h:panelGrid>

If I fire ‘enter’-event the regexSave-Method will be actioned. But the Method for saveOrUpdateHour,too….

Meanwhile I have configure my code a little. Now the textfield and button are in the header of my table.

    <h:panelGrid columns="3" id="tableGrid">
            <p:dataTable id="hoursList" value="#{hoursView.listHours}"
                var="hours" widgetVar="hoursTable" resizableColumns="true"
                emptyMessage="#{msg.noData}" rowKey="#{hours.id}"
                selection="#{hoursView.selected}" selectionMode="single">

                <p:ajax event="rowDblselect" update=":hourEditDialog"
                    listener="#{hoursView.onHourSelect}"
                    oncomplete="dlgHourEdit.show()" />

                <f:facet name="header">
                    <h:panelGrid columns="3" class="buttonContent" id="regexContent">
                        <h:outputText value="#{msg.regexHour}" />
                        <p:inputText value="#{hoursView.regex}" id="regex">
                        </p:inputText>
                        <p:commandButton icon="addButton" id="regexSave"
                            process="regexContent" actionListener="#{hoursView.regexSave}"
                            update=":editContent:hoursList,:editContent:growl,regex">
                            <p:defaultCommand target="regexSave" scope="regexContent" />
                        </p:commandButton>
                        <p:tooltip for="regexSave" value="#{msg.regexSave}"
                            showEffect="fade" hideEffect="fade" />
                    </h:panelGrid>
                </f:facet>   ....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:01:34+00:00Added an answer on June 11, 2026 at 7:01 pm

    You can use onkeypress of the p:inputText and with the help of jquery call the .click() on your button, note that return false; will make sure that nothing (p:ajax for example) will be called after the enter will be pressed

    like this:

    <p:commandButton id="myButtonID" actionlistener="#{beans.method}" />
    
    
    <p:inputText value="#{beans.text}" onkeypress="if (event.keyCode == 13) { jQuery('#myButtonID').click(); return false;}"/>
    

    Update
    Instead of :editContent:hoursList try update="tableGrid" (refer to the table wrapper) or if you are using primefaces 3.4 try update="hoursList"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
In JSF + RichFaces, I have an inputText and a button, How can I
I have such code: <h:inputText id=input value=#{bean.input}> <f:convertNumber /> <rich:ajaxValidator event=onblur /> </h:inputText> I
I have an input text field, which has a value something by default, but
I have an inputText and a commandButton in a JSF page. The user inputs
Suppose I have two h:inputText components. I want to bind both of the text
I have jsf page: .... <form jsfc=h:form action=> <h:dataTable value=#{newMusician.strings} var=preferredMusicGenre id=musicGenresSelectTable> <h:column> <h:inputText
I have integer properties from my bean binded to inputtext UI elements in jsp
I have three radio buttons, an inputText and a submit button. I only want
I have a page with two text fields and a commandButton , in one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.