Triggering the action of a commandbutton on <enter>

UI Components for JSF
Post Reply
karlkras
Posts: 46
Joined: 26 Jan 2020, 01:54

27 Sep 2021, 18:16

Hello,
I have a "search" control that is triggered via a command button within the context of a PF form which works fine when normal clicking of the button.
What I'm trying to figure out is how to direct the press of the <enter> key to fire this same action.
There is no other submit element in this form, so currently the action will simply ends the form processing entirely (something else to address), but adding

Code: Select all

type=submit
to the commandButton doesn't appear to work either.
Any pointers on how to achieve this desired functionality?

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

28 Sep 2021, 14:29

You want p:defaultCommand like this: https://www.primefaces.org/showcase/ui/ ... asic.xhtml
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests