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!

In amx page How to set focus on input text programmatically

Hassan MoukahalApr 29 2021 — edited May 1 2021

Javascript var input= getelementbyid() then input.focus() is not working

This post has been answered by Hassan Moukahal on May 2 2021
Jump to Answer

Comments

Timo Hahn

User, tell us your exact jdev version, please!
What is an amx page?

In general, getelementbyid without a parameter (the id) can't work.

Timo

Hassan Moukahal

Thank you for your fast answer . Jdeveloper version is 12.2.1.3. The amx page is a test MAF amx page used to test how to set focus (blinking cursor) to inputText whose id is it1. So im calling a javascript with the following code:

var input= document.getElementbyId(“it1”);
input.focus();
it doesn’t work.

image.jpg

Timo Hahn

~I moved the question over to the MAF category.~
Moved the post back to JDev&ADF as the MAF category can't be accessed by normal users.

Have you checked that your function is finding the inputText?
Do you see the right data in your alert?
I'm not sure if this works for MAF but in ADF you can do it like shown here https://blogs.oracle.com/jdevotnharvest/how-to-programmatically-set-focus-on-an-input-component

Hassan Moukahal
Answer

the issue is solved by using
var input =document.getElementById("it1__inputElement"); instead of
var input =document.getElementById("it1");

Thanks

Marked as Answer by Hassan Moukahal · May 2 2021
1 - 4

Post Details

Added on Apr 29 2021
4 comments
147 views