Hello,
I have 2 pages on the screen (actually more as it is a kind of proprietary web application with a few frames and I cannot figure out actually the whole structure)
I enter the search criteria in a page, I press ‘Enter’ on the keyboard , search is executed and the other view is filled with data. There is a button ‘Confirm’ on this 2nd view and the user has to click on it.
I’d like the user to press ‘Enter’ on the keyboard and ‘Confirm’ to be executed.
If I click on a field on this 2nd view and I press ‘Enter’, ‘Confirm’ is executed so it is a matter of moving the focus of the mouse from the first page to the other one.
How could I achieve this programmatically ?
I have tried the following
<SCRIPT FOR=window event=onload language="JScript">
var focusField = "<%= controller->component_id %>" + '_' + 'NUMBER';
document.getElementById(focusField).focus();
</SCRIPT>
Cursor still in the input field in the first page.
<SCRIPT FOR=window event=onload language="JScript">
var focusField = "<%= controller->component_id %>" + '_' + 'NUMBER';
alert(document.getElementById(focusField).value);
document.getElementById(focusField).focus();
</SCRIPT>
The value of the field is displayed so the code goes through there
Cursor still in the input field in the first page
<SCRIPT FOR=window event=onload language="JScript">
var focusField = "<%= controller->component_id %>" + '_' + 'NUMBER';
document.getElementById(focusField).focus();
alert('1');
alert('2');
</SCRIPT>
Cursor still in the input field in the first page
<SCRIPT FOR=window event=onload language="JScript">
var focusField = "<%= controller->component_id %>" + '_' + 'NUMBER';
alert('1');
document.getElementById(focusField).focus();
alert('2');
</SCRIPT>
And the cursor 'moved out' the input field somehow 'miraculously' and 'Enter' works on the 2nd page !!!
Why's that ?
Of course, it is not a solution but I wonder why using alerts (but 2 not 1) achieves my purpose of moving the focus of the mouse.
Thanks