Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: EE-3.3.0.GA_P02, 4.0
-
Fix Version/s: EE-3.3.0.GA_P03, 4.1
-
Component/s: Framework, ICECORE-Components
-
Labels:None
-
Environment:All
-
Assignee Priority:P1
-
Support Case References:Support Case #13325 - https://icesoft.my.salesforce.com/50070000013W5UR
-
Workaround Exists:Yes
-
Workaround Description:If possible, turn off the IECfaces focus retention with the icecore:config focusManaged=false tag.
Description
A call to ice.applyFocus is being overridden by the ICEfaces focus retention. The call is used as follows and is trying to set focus to an input that is already in the form:
<ice:commandButton id="clearBtn" value="Clear"
actionListener="#{testBean.clear}"
onclick="ice.applyFocus('iceForm:inputOne');"/>
<ice:commandButton id="clearBtn" value="Clear"
actionListener="#{testBean.clear}"
onclick="ice.applyFocus('iceForm:inputOne');"/>
Now that I got the test case the solution is obvious. The function that needs to be used in onclick callback should be ice.setFocus instead of ice.applyFocus. This ensures that ice.focus parameter will be changed before the submit is issued (ice.applyFocus runs with a delay).
Setting the focus this way will enable focus retention to send back
command to maintain focus on the element with the ID specified in ice.focus parameter. This is a strategy that many of our components and demo apps are using.
The test code just needs to be changed like this: