Message Boards

How to remove focus from form fields?

Danilo Silva, modified 2 Years ago.

How to remove focus from form fields?

New Member Post: 1 Join Date: 12/16/21 Recent Posts

Hello everyone, I'm making a home page of a site that contains a form using the liferay dxp 7.3.10 form portlet. When I open the page, it automatically focuses on one of the form's fields, moving the page to it, but I don't want that behavior. ​​​​​​​

thumbnail
Russell Bohl, modified 2 Years ago.

RE: How to remove focus from form fields?

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

Hi Danilo, can you provide some detailed steps to reproduce this? Include things like the exact Liferay version and whether you're using a Widget Page or Content Page.

Lee Jordan, modified 2 Years ago.

RE: RE: How to remove focus from form fields?

Expert Posts: 449 Join Date: 5/26/15 Recent Posts

1) Create a form with two text inputs like Firstname Lastname
2) Add a widget page, with a lot of basic web content at the top of the page
3) Add the form display widget
4) Select the form created
5) Visit the widget page

Actual:
Page jumps down to form upon page load and flashes a cursor sometimes in a random filed of the form.

Expected:
Focus remains at the top of the page upon page load and user is not taken to the form on page load.

thumbnail
Russell Bohl, modified 2 Years ago.

RE: RE: How to remove focus from form fields?

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

I can't reproduce on 7.4, will try on the latest 7.3

thumbnail
Russell Bohl, modified 2 Years ago.

RE: RE: How to remove focus from form fields?

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

Interestingly, I cannot reproduce on 7.3 DXP SP3, but I can reproduce on 7.3 CE GA8. So I think you're probably stuck with the workaround for noe as I'm not aware of plans to release more 7.3 GAs.

Lee Jordan, modified 2 Years ago.

RE: How to remove focus from form fields?

Expert Posts: 449 Join Date: 5/26/15 Recent Posts

I have suffered the same fate. The only real way around it I found was to add a widget page with the form on it. Go to the configuration and sharing, get the iframe for the widget (keep that widget on that page). Go to the homepage and add a basic web content (in my case I have a web content template callled "HTML" so I can avoid basic web).

Embed the iframe for the form on the homepage and maybe set the hieght of the iframe to the height of the form.

That should isolate the form from the homepage and so the focus of the browser goes to the homepage not the form.

Lee Jordan, modified 1 Year ago.

RE: How to remove focus from form fields?

Expert Posts: 449 Join Date: 5/26/15 Recent Posts

Hang in there, unfortunatly if we as the community report issues they often don;t get looked at.

However by chance this may have been discovered internally (even though we got to it first)
https://issues.liferay.com/browse/LPS-152495