hello all ,
inspiration from the use case which have encountered in last days , i decide to share my learning
inspiration from the use case which have encountered in last days , i decide to share my learning
Today's Discussion :
the use case is pretty simple that
"How can we use Enter key instead of Tab key in af:form in ADF application just like in Oracle forms "
so here is the simple and brief solution about this use case
i will use java script function and client listener for this
i am using jdeveloper Studio Edition Version 11.1.2.3.0 11gR2
step 1:
first of all create the simple application base on HR Schema and cretae the Employees view object and based on employees entity and then drag it as Form on page just like below
step 2:
now go to page source and paste this javascript code :
<af:resource type="javascript">
function myonkeypressbookdate(componentEvent)
{
var evt = componentEvent.getNativeEvent();
var keyCode = AdfAgent.AGENT.getKeyCode(evt);
if (AdfAgent.AGENT.getKeyCode(evt) == 13) // 13 is ENTER
{
AdfFocusUtils.focusNextTabStop(componentEvent.getNativeEventTarget());
}
}
</af:resource>
step 3
now back to the design mode of page and select one of inputtext from form and then drag
af:clientlistener from component pallet set the properties as below:
for example i have seleted firstName and set the property as
<af:inputText value="#{bindings.FirstName.inputValue}" label="#{bindings.FirstName.hints.label}"
required="#{bindings.FirstName.hints.mandatory}"
columns="#{bindings.FirstName.hints.displayWidth}"
maximumLength="#{bindings.FirstName.hints.precision}"
shortDesc="#{bindings.FirstName.hints.tooltip}" id="it2">
<f:validator binding="#{bindings.FirstName.validator}"/>
<af:clientListener method="myonkeypressbookdate" type="keyPress"/>
</af:inputText>
or as in figure:
now run the page press CreateInsert , the focus will be on FirstName ,
Press Enter key insted of tab , you will see the focus navigate to next Inputtext for example Last Name
:)
Note:
but for using Enter Key for all input text we have to write the class which cretae client listener to all inputtext present on page
just a 2 step more ,