Page 1 of 1

Disabling form focus?

Posted: 31 Jan 2011, 06:11
by tomik
Hi,

I don't have the <p: focus /> on my page, but yet the first input box gets automatically focused once the page is rendered.

Is there a way to turn this feature off?

I am using Primefaces 2.2.RC2-SNAPSHOT, JSF 2, and Spring Web Flow.

Thanks much!

Tom

Re: Disabling form focus?

Posted: 31 Jan 2011, 07:32
by healeyb
BTW - what is your first input box? you didn't specify. I just wondered if
you were using something that might have some built in functionality to
do this because I don't see this behaviour without using p:focus or js
equivalent ( <h:body onload="document.getElementById('form:id').focus()"> ).

Regards,
Brendan.

Re: Disabling form focus?

Posted: 31 Jan 2011, 20:52
by tomik
I am using a simple <h: inputText> tag. There no such code that you mention.

Somewhere (I think Primefaces documentation) I read that <p: focus /> does not even have to be specified to make the site automatically focus in on the first element of the page's form. I would expect to be able to disable this behavior.

Thanks,

T.

Re: Disabling form focus?

Posted: 31 Jan 2011, 20:53
by tomik
I also forgot to mention that this form is in a (Primefaces) dialog.

T.

Re: Disabling form focus?

Posted: 03 Feb 2011, 06:45
by MarkB
Do you use <p:focus/> anywhere within the <h:body> section of your page? It will be inherited by all sub-sections once it is defined.