Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leaving textbox control
Message
De
31/07/2003 13:54:35
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00813238
Message ID:
00815528
Vues:
11
::Is it possible make asp.net form work somewhat like a VFP form where once user enters the text in a textbox (specified in Columns property) the focus goes to the next textbox? That is, without user having to mouse click or tab out of the textbox.

I am assuming your are referring to an example where you have three input boxes for a social security number and when they enter the last digit in each input box you want the focus to automatically jump to the next box?

If this is the case then you can use JavaScript to do this. An example follows:
<script language="JavaScript">
  function oFocus(){
    if(len(this.myform.s1.value) == 3)
      {
         this.myform.s2.focus();
      }
  }

  function oFocus1(){
    if(len(this.myform.s2.value) == 2)
      {
         this.myform.s3.focus();
      }
  }
</script>


<body>
  <form id="myform">
     <asp:input onchange="javascript:cFocus()" type="textbox" id="s1" maxlength=3 />
     <asp:input onchange="javascript:cFocus1()" type="textbox" id="s2" maxlength=2 />
     <asp:input type="textbox" id="s3" maxlength=4 />

  </form>
</body>
You can optimize the script some more but you get the general idea. I hope my syntax is correct!

HTH

WEs
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform