In the onkeypress I still see the same code, with the encoded &... you
should call your function instead.
I would recommend using the excellent Firebug [1] plugin if you are
using firefox. As it will complain that there are javascript errors in
the page and it will ease your pain a little :-)
Cheers,
Bruno
[1] https://addons.mozilla.org/en-US/firefox/addon/1843
On 25/05/07, Bjørn T Johansen <[EMAIL PROTECTED]> wrote:
I tried putting the submitEnter function in a js file and added the file in the
<head> tag but I still get the
same result...
Here is the source of the page that is generated now..:
<form id="content:formFindArticle" name="content:formFindArticle" method="post" action="/nibstoreweb/secure/article/findarticle.faces"
enctype="application/x-www-form-urlencoded"><input id="content:formFindArticle:popupArticleGroupSubmit" name="content:formFindArticle:popupArticleGroupSubmit"
type="submit" value="popupArticleGroupSubmit" onclick="if(typeof
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof
window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}" style="display:none" />
<input type="hidden" name="autoScroll" />
<input id="content:formFindArticle:popupSupplierSubmit" name="content:formFindArticle:popupSupplierSubmit" type="submit" value="popupSupplierSubmit" onclick="if(typeof window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}" style="display:none" /><table border="0" cellpadding="5" cellspacing="0"><tr><td colspan="2"> </td></tr><tr><td class="label"><label for="content:formFindArticle:varenr">Varenrsøk: </label></td><td class="input" colspan="3"><input id="content:formFindArticle:varenr" name="content:formFindArticle:varenr" type="text" value="" maxlength="25" size="25" onkeypress="return submitEnter('content:formFindArticle:search',
event);" /></td></tr><tr><td class="label"><label for="content:formFindArticle:overgruppe">Varegruppesøk: </label></td><td class="input"><input id="content:formFindArticle:overgruppe" name="content:formFindArticle:overgruppe" type="text" value="" maxlength="2" size="2" /><input id="content:formFindArticle:hovedgruppe" name="content:formFindArticle:hovedgruppe" type="text" value="" maxlength="2" size="2" /><input id="content:formFindArticle:undergruppe" name="content:formFindArticle:undergruppe" type="text" value="" maxlength="5" size="5" onkeypress="if ((event.charCode && event.charCode == 13) || (event.keyCode && event.keyCode == 13)) document.getElementById('content.formFindArticle:search').onclick();" /><input id="content:formFindArticle:_idJsp22"
name="content:formFindArticle:_idJsp22" type="submit" value=">" onclick="if(typeof window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}" /></td></tr><tr><td class="label"><label for="content:formFindArticle:fritekst">Fritekstsøk: </label></td><td class="input"><input id="content:formFindArticle:fritekst" name="content:formFindArticle:fritekst" type="text" value="" maxlength="50" size="40" /></td></tr><tr><td> </td><td><input id="content:formFindArticle:search" name="content:formFindArticle:search" type="submit" value="Søk" onclick="if(typeof
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}" /></td></tr><tr><td> </td></tr></table><input type="hidden" name="content:formFindArticle_SUBMIT" value="1" /><input type="hidden" name="content:formFindArticle:_link_hidden_" /><input type="hidden" name="content:formFindArticle:_idcl" /><script type="text/javascript"><!--
BTJ
On Fri, 25 May 2007 12:38:28 +0100
"Bruno Aranda" <[EMAIL PROTECTED]> wrote:
> Or you can also use a script tag, like in the third example of this page:
>
> http://wiki.apache.org/myfaces/SubmitPageOnValueChange
>
> Cheers,
>
> Bruno
>
> On 25/05/07, Bruno Aranda <[EMAIL PROTECTED]> wrote:
> > I think I see a myfaces bug in the onkeypress. It seems that the &
> > have been encoded. As a workaround use a external javascript file with
> > a function for the onkeypress and call it.
> >
> > Could you fill a JIRA also?
> >
> > Thanks!
> >
> > Bruno
> >
> > On 25/05/07, Bjørn T Johansen <[EMAIL PROTECTED]> wrote:
> > > That I can....:
> > >
> > > <form id="content:formFindArticle" name="content:formFindArticle"
method="post"
> > > action="/nibstoreweb/secure/article/findarticle.faces"
enctype="application/x-www-form-urlencoded"><input
> > > id="content:formFindArticle:popupArticleGroupSubmit"
name="content:formFindArticle:popupArticleGroupSubmit"
> > > type="submit" value="popupArticleGroupSubmit" onclick="if(typeof
> > >
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof
> > >
window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}"
> > > style="display:none" /> <input type="hidden" name="autoScroll" />
> > >
> > > <input id="content:formFindArticle:popupSupplierSubmit"
name="content:formFindArticle:popupSupplierSubmit"
> > > type="submit" value="popupSupplierSubmit" onclick="if(typeof
> > >
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof
> > >
window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}"
> > > style="display:none" /><table border="0" cellpadding="5"
cellspacing="0"><tr><td
> > > colspan="2"> </td></tr><tr><td class="label"><label
for="content:formFindArticle:varenr">Varenrsøk:
> > > </label></td><td class="input" colspan="3"><input
id="content:formFindArticle:varenr"
> > > name="content:formFindArticle:varenr" type="text" value="" maxlength="25"
size="25" onkeypress="if
> > > ((event.charCode && event.charCode == 13) || (event.keyCode
&& event.keyCode == 13))
> > > document.getElementById('content:formFindArticle:search').onclick();"
/></td></tr><tr><td
> > > class="label"><label for="content:formFindArticle:overgruppe">Varegruppesøk:
</label></td><td
> > > class="input"><input id="content:formFindArticle:overgruppe"
name="content:formFindArticle:overgruppe"
> > > type="text" value="" maxlength="2" size="2" /><input
id="content:formFindArticle:hovedgruppe"
> > > name="content:formFindArticle:hovedgruppe" type="text" value="" maxlength="2"
size="2" /><input
> > > id="content:formFindArticle:undergruppe" name="content:formFindArticle:undergruppe"
type="text" value=""
> > > maxlength="5" size="5" onkeypress="if ((event.charCode &&
event.charCode == 13) || (event.keyCode
> > > && event.keyCode == 13))
> > > document.getElementById('content.formFindArticle:search').onclick();"
/><input
> > > id="content:formFindArticle:_idJsp22" name="content:formFindArticle:_idJsp22"
type="submit" value=">"
> > > onclick="if(typeof
> > >
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof
> > >
window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}"
/></td></tr><tr><td
> > > class="label"><label for="content:formFindArticle:fritekst">Fritekstsøk:
</label></td><td
> > > class="input"><input id="content:formFindArticle:fritekst"
name="content:formFindArticle:fritekst"
> > > type="text" value="" maxlength="50" size="40"
/></td></tr><tr><td> </td><td><input
> > > id="content:formFindArticle:search" name="content:formFindArticle:search" type="submit"
value="Søk"
> > > onclick="if(typeof
> > >
window.clearFormHiddenParams_content_formFindArticle!='undefined'){clearFormHiddenParams_content_formFindArticle('content:formFindArticle');}if(typeof
> > > window.getScrolling!='undefined'){oamSetHiddenInput('content:formFindArticle','autoScroll',getScrolling());}"
/></td></tr><tr><td> </td></tr></table><input
> > > type="hidden" name="content:formFindArticle_SUBMIT" value="1" /><input
type="hidden"
> > > name="content:formFindArticle:_link_hidden_" /><input type="hidden"
> > > name="content:formFindArticle:_idcl" /><script type="text/javascript"><!--
> > >
> > >
> > >
> > >
> > > BTJ
> > >
> > >
> > > On Fri, 25 May 2007 07:21:41 -0400
> > > "William Hoover" <[EMAIL PROTECTED]> wrote:
> > >
> > > > Could you show a snippet of the browser output with the input, button
and form?
> > > >
> > > > -----Original Message-----
> > > > From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, May 25, 2007 7:19 AM
> > > > To: [email protected]
> > > > Subject: Re: Submit using the enter key?
> > > >
> > > >
> > > > Tried this but with the same result...
> > > >
> > > > BTJ
> > > >
> > > > On Fri, 25 May 2007 07:10:05 -0400
> > > > "William Hoover" <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > 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:[EMAIL PROTECTED]
> > > > > 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 <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
> > > > > > > >
> > > > > > > > [EMAIL PROTECTED]
> > > > > > > >
-----------------------------------------------------------------------------------------------
> > > > > > > > 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.
> > > > > >
> > > >
> > >
> > >
> > > --
> > > 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.