3 Replies Latest reply on Sep 9, 2006 12:08 AM by raja05

    Default action for JSF page?

    texan

      In the context of a Seam application, is there a way to setup a default action to execute when a user hits the "enter" key in an input field?

      I know this is more of a JSF question, but I'm not always clear on the boundary between JSF and Seam...

        • 1. Re: Default action for JSF page?
          mzeijen

          isn't that just a form submit? If the html form contains a submit button then this behaviour should be default. So the action behind the submit button is fired.

          • 2. Re: Default action for JSF page?
            texan

            When I hit return on a page, it re-renders that page rather than executing the action on a particular button (or any button for that matter).

            • 3. Re: Default action for JSF page?
              raja05

              I think browsers behave differently for this. if there is only one form field on a page, then hitting enter will do the same as a submit but Ive seen posts where IE takes any enter on text field as a submit.
              You could use the onkeypress attribute on JSF's inputtext to have a javascript that will capture window.event.keyCode and check if thats equal to 13, do the same as what your button needs to do but these details are totally out of JSF and Seam IMO.