Discussions
Categories
- 197K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 556 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
When any error popup is closed, focus should get set to in the field in which error is present

Hi,
We have required input fields in our page, when we are not filling all fields and clicking on next button will get error popup. When we close that popup, focus should be set the that field only but focus is going to other actionable item. Please suggest something. Which property to add to set focus on that field in ADF.
I am using Jdev version: Studio Edition Version 12.2.1.4.0
Answers
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond
User, show us how you have configured to show the error popup, please.
How should this work if you have multiple errors?
Timo
-
Hi,
This is code snnipet for jsff:
af:panelLabelAndMessage label="#{bindings.FirstName.hints.label}*" id="plam1" styleClass="firstLabel">
<f:facet name="end">
<af:inputText value="#{bindings.FirstName.inputValue}"
label="#{bindings.FirstName.hints.label}"
simple="true"
required="#{bindings.FirstName.hints.mandatory}"
columns="#{bindings.FirstName.hints.displayWidth}"
maximumLength="#{bindings.FirstName.hints.precision}"
shortDesc="#{bindings.FirstName.hints.tooltip}" id="it1"
binding="#{backingBeanScope.clauseSearchBackingBean.firstNameBind}">
<f:validator binding="#{bindings.FirstName.validator}"/>
</af:inputText>
</f:facet>
</af:panelLabelAndMessage>
And code snnipet for Bean class:
else if(FirstName==null){
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Please enter First Name");
context.addMessage(null, msg);
Please find Screen shot for reference:
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond
Have you tried what happens if you set the error message to the component instead of putting it to the global list?
For this, you have to add the client id of the component to the addMessage method like
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, msgHead , msgDetail); facesContext.addMessage(uiComponent.getClientId(facesContext), msg);
Timo
-
Have you tried what happens if you set the error message to the component instead of putting it to the global list?
For this, you have to add the client id of the component to the addMessage method like
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, msgHead , msgDetail); facesContext.addMessage(uiComponent.getClientId(facesContext), msg);
What is msgHead here?
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond
Have you checked the documentation?
Timo
-
Yes. I have checked the document. In my case what the uiComponent and msgHead? For me, we are passing null
else if(FirstName==null){
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Please enter First Name");
context.addMessage(null, msg);
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond
Sorry, but the doc is pretty clear about the parameters, isn't it?
The first parameter is the severity, the second parameter is a string that is shown as a summary, and the third is the message detail.
An easy task is to just put "Hello" as the second parameter and "world" as the third parameter. Then see what happens.
The next doc to check is the one for FacesContext.addMessage(...)
Here you can add the clientId of the component the error message should be attached to.
Timo