Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Way to Place Focus on a DTC Button So That...?

Status
Not open for further replies.

peggasus88

Technical User
Feb 25, 2002
28
0
0
US
Hi everyone,

I have a simple page with one Textbox DTC, one Button DTC, and one Grid DTC. When I enter a value into the textbox and then click the button, the grid displays a record corresponding to the textbox value.

This page will be used repeatedly and for the sake of user friendliness =), I would like a way for the user to remain on the keyboard, i.e. to input the textbox value via the keyboard and then hit the 'Enter' key on the keyboard, rather than entering the textbox value via the keyboard and then moving over to the mouse to click the button.

Is there was a way to place focus on the DTC button so that the user can hit 'Enter' on the keyboard, rather than moving over to the mouse? Forms seem to automatically have this functionality. I know that the user can hit 'Tab' to place focus on the button, but despite knowing this, my gut reaction (and probably other people's) is to hit 'Enter' on the keyboard after entering the textbox value...Right now, if the keyboard cursor is inside the textbox and then I hit 'Enter' on the keyboard, the page seems to make a server round trip! And as expected, the appropriate information is not displayed in the grid. Placing focus on the button using client-side script (as suggested in another post) hasn't worked for me because when I'm inputting a value into the textbox, the button loses focus.

Any help is really appreciated.


~*Peggy*~
 
I have not found any documentation that would suggest a rock-solid solution. However, try these ideas..

If the button is of Image type, then this seems to do the trick. (The FIRST such button on the page seems to get 'clicked').

Alternatively, add a submit button. Then do a 'view source' for the page, and copy the onClick code for the DTC button something like...

onclick="thisPage._fireEvent('pbAddNew','onclick'); return false;"

and add this onClick event to your submit button.
Now hide the original DTC button. A submit button seems to get the default click in some browsers - well, its worth a try!

I am sure that you could set the focus when the page loads using javascript, but I have not tried this yet. I am not sure if it would have the desired affect anyway.

You could try trapping the Enter keypress, and causing a submit using javascript - but this is problematic to code given the different browsers handle events.
(Content Management)
 
Hello Peggy,

It's Computergeek... just wondering if you solved the Grid DTC Navbar / Vertical scroll problem where after clicking the anchor is does a server trip and puts you at the beginning of the grid within the scroller...

Please post a reply under the Grid DTC Navbar / Vertical scroll thread at the beginning of this forum.

Thanks,

Computergeek
 
Thank you Merlin! Changing the button to an Image works great. I misinterpreted your suggestion a couple months ago, but now that I'm more familiar with VI, I understand. :)
Do you happen to know if it works for IE 6.0? (It works for IE 5.0.) My co-worker has IE 6.0 and hitting 'Enter' on the keyboard doesn't 'click' the image; he is also running Windows XP, so I don't know if it's a browser issue or an OS issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top