moving from form element to form element

R

Rod Snyder

I'm looking for a way that when a user enters the required information in a
form text box, the cursor automatically moves to the next textbox (asp.net).
Can this be done in ASP.NET or must it be done with client side javascript.
If client side, does anyone know of an example to look at?
Rod
 
V

Vidar Petursson

Hi

Client scripting issue...here is something to get you going hopefully
<form>
<input name="myInput1" onchange="doValidate(this,this.form.myInput2)">
<input name="myInput2" onchange="doValidate(this,this.form.myInput3)">
etc
</form>

function doValidate(elSrc,elFocusTo){
if(elSrc.value == "blah") elFocusTo.focus();//Pretty basic check ;-)
else
{
alert("Blah blah");
elSrc.focus();
}
}

Server:
myInput1.Attributes.Add("onchange","doValidate(this,this.form.myInput2)");
etc

--
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
==============================
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top