moving from form element to form element

  • Thread starter Thread starter Rod Snyder
  • Start date Start date
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
 
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
==============================
 
Back
Top