Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting default button in a page using java scrip

AakiDec 10 2013 — edited Dec 11 2013

Hi,

Iam using jdev 11.1.2.0.0

my scenario is i would like to set a command button as a default button in my page at the page load itself.

I can't use <af:form> tag here because af:form element belongs to the  parent page and that we can only have a single af:form component per browser page else we will get error as multiple forms for single viewId.

I tried using java script as follows ... but at the time of page load, button is not set as default....after entering text into the input field then event is triggered and button getting clicked.

Javascript

function onClickEnterKey(inputEvent) {

         

          if (inputEvent.getKeyCode() == AdfKeyStroke.ENTER_KEY) {

              var inputTextField = inputEvent.getSource();

              var defaultButton = inputTextField.findComponent('cb1');

              var partialSubmit = true;

              AdfActionEvent.queue(defaultButton, partialSubmit);

              inputEvent.cancel();

          }

      }

Is there any possibility to achieve my scenario with out adding client Listener to input text field and making button as default one. Pease suggest me. Thanks in advance.

Regards

Alekhya

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2014
Added on Dec 10 2013
8 comments
467 views