myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Hoover" <whoo...@nemours.org>
Subject RE: Submit using the enter key?
Date Fri, 25 May 2007 11:10:05 GMT
Just an FYI... You may need to add code for browser compatibility (Notice that the "click()"
has been changed to "onclick()"):

if ((event.charCode && event.charCode == 13) || (event.keyCode && event.keyCode
== 13)) document.getElementById('formFindArticle:search').onclick();

-----Original Message-----
From: Bruno Aranda [mailto:brunoaranda@gmail.com]
Sent: Friday, May 25, 2007 6:50 AM
To: MyFaces Discussion
Subject: Re: Submit using the enter key?


Because I guess that the default behaviour of the browser is to click
the submit button when pressing enter. This is why you get the same
behaviour. Maybe the javascript of your onkeypress is not rendered on
the page. I seem to recall a similar but, but I don't remember if it
is this one, where some of the on* attributes where not rendered in
the page.

Bruno

On 25/05/07, Bjørn T Johansen <btj@havleik.no> wrote:
> Well, if I debug my app and put a breakpoint in my search method, I do get inside my
search method and the exact
> same thing happends in that method no matter it I press the Enter key og click the submit
button...
>
>
> BTJ
>
> On Fri, 25 May 2007 11:22:20 +0100
> "Bruno Aranda" <brunoaranda@gmail.com> wrote:
>
> > Can you verify if the onkeypress attribute is rendered on the input by
> > looking at the generated source code?
> >
> > Firebug works great to check these things,
> >
> > Cheers,
> >
> > Bruno
> >
> > On 25/05/07, Bjørn T Johansen <btj@havleik.no> wrote:
> > > I am trying to submit a form using the enter key, but it doesn't work...
> > > I have the following code in mye jsp:
> > >
> > > <h:inputText ..... onkeypress="if (event.keyCode == 13)
> > > document.getElementById('formFindArticle:search').click();">
> > >
> > > and it does call the search method that is specified in th search button but
there is one difference compared
> > > to clicking the button itself..
> > >
> > > The action method opens a popup window using the Tomahawk's ExtestionFilter
to inject the Javascript in the
> > > rendered page and this opens as it should when clicking the button and calling
the search method. But calling
> > > the same search method when pressing Enter does nothing... Or I can see the
page being submitted and I see
> > > that the search method is called, but it just redraws the page without opening
the popup...
> > >
> > > What am I missing?
> > >
> > >
> > > Regards,
> > >
> > > BTJ
> > >
> > > --
> > > -----------------------------------------------------------------------------------------------
> > > Bjørn T Johansen
> > >
> > > btj@havleik.no
> > > -----------------------------------------------------------------------------------------------
> > > Someone wrote:
> > > "I understand that if you play a Windows CD backwards you hear strange Satanic
messages"
> > > To which someone replied:
> > > "It's even worse than that; play it forwards and it installs Windows"
> > > -----------------------------------------------------------------------------------------------
> > >
> > > --
> > > This message has been scanned for viruses and
> > > dangerous content by MailScanner, and is
> > > believed to be clean.
> > >
> >
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>


Mime
View raw message