Initial text problem

I have a simple question.

I have few feathers inputtext

and two straight lines commandbutton

in my xhtml page. When I press enter after editing the input text, it runs one of my commands.

But I want to bring up another command menu. How to do it? And how does he decide which one commandbutton

should be launched? What is the reason?

Thanks for the help.

+3


source to share


2 answers


you can use p:defaultCommand



<p:defaultCommand target="btnId" />

      

+3


source


You can catch the "hit enter event" in JavaScript and simulate a click on a button of your choice.

Something like that:



$('#yourInput').on('keyup', function(e) {
    if (e.which == 13) {
        $("#yourButton").click();
    }
});

      

+1


source







All Articles