Input field focus after postback - v1.1

A

Adrian Parker

v1.1 - After taking off smartnav (due to it not working properly), I've got code that will restore the scroll position of the page
on
postback, but now I'm looking at how to set focus on either a field that has failed validation or on the next input field down the
page. What's the best approach. I've started by adding an onfocus attribute to each input field that records its ID in a hidden
field. Can I just read down through the DOM until I find that control and then either set focus on ir or the next input field
accordingly ?
 
S

Steven Cheng[MSFT]

HI Adrian,

I think you can consider using client side script to set the focus on those
certain html elements. You can use document.getElementById to reference to
a input control's clientside html element. Or you can also use
getElementByTagName to get the collection of all input text boxes and loop
them to set the certain textbox as the focused element.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top