?
Solved

How to get the focus to the button when the p:dialog pops up?

Posted on 2014-08-04
1
Medium Priority
?
1,005 Views
Last Modified: 2014-08-21
<p:dialog widgetVar="selectBriefDlg"
                     closable="false"
                     modal="true"
                     header="Selected Sections">
             <p:dataList id="reviewChosenList" value="#{bean.list}" type="definition" var="selected">
                   #{selected}
             </p:dataList>
             <div style="float:right; margin-top:10px;">
                   <p:commandButton id="btnClose" value="Close"  onclick="selectBriefDlg.hide();"/>
             </div>
</p:dialog>

Above is a primefaces dialog. Everything works great. All I want is when this dialogbox pops up, the "btnClose" to have focus by default.

Can someone help?
0
Comment
Question by:prain
1 Comment
 
LVL 17

Accepted Solution

by:
contactkarthi earned 1000 total points
ID: 40243641
<p:dialog widgetVar="selectBriefDlg"
                     closable="false"
                     modal="true"
                    focus="btnClose"
                     header="Selected Sections">
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses
Course of the Month16 days, 12 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question