I have a form where users will input phone numbers. The way it is set up is with three text boxes. First for phone prefix( 314) then second for the middle number (546) and finally third for last four digits (4563). What i am being asked to do is the cursor need to jump to second text box as soon as user inputs 3 digits on the first text box. and so on. Is there a way to accomplish this. Please help!!
Thank you in advance.
9 5275 Plater 7,872
Recognized Expert Expert
You can but you need to be pretty carefull about it.
You need to watch the keypress events for the textboxes (javascript event)
Then you have to watch to see if:
A) the maximum allowed characters are already in the box (for the first box it would be 3)
B) that the key being pressed is a character key and not a control key (like arrow keys, backspace, delete, etc, etc) so that you don't keep jumping to another textbox when someone presses the arrow key.
Then if the end is reached, set focus to your next control.
The folks over in the javascript section might be able to explain it a bit better.
Thanks ,
This means that i will have to use AJAX for this. I know how to do this in classic asp but i am new to AJAX so way confused . Isnt there any other simple solution ??
Plater 7,872
Recognized Expert Expert
Well, you don't HAVE to use ajax for this. I don't think you need to have it keep coming back to the server for anything?
can you provide me with example on how can it be done? please
Plater 7,872
Recognized Expert Expert
I will do you one better and move the question over to the section where people could give you a good example.
MODERATOR
acoder 16,027
Recognized Expert Moderator MVP
The posting is for simple html form. Can you please provide me with the example on how to do this with asp.net form.
thank you in advance.
Plater 7,872
Recognized Expert Expert
The posting is for simple html form. Can you please provide me with the example on how to do this with asp.net form.
thank you in advance.
Same thing. ASP.NET still just makes a regular HTML form.
And you're going to be doing this with javascript anyway.
acoder 16,027
Recognized Expert Moderator MVP
Yes, that's right. When the server-side code gets to the browser it's been translated/converted into client-side HTML markup. View source in your browser and you'll see.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: francisco lopez |
last post by:
ok , first of all sorry if my english is not so good, I do my best.
here is my problem:
I don´t know much javascript so I wrote a very simple one to validate
a form I have on my webpage.
could you please have a look at the following script:
------------------------------------------------------------
|
by: Seash |
last post by:
Hi friends ,
here is the sample code
private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar == 13) //enter
{
txtbox2.Focus();
}
|
by: CharlesA |
last post by:
Hi folks,
first off, I'm using .Net framework 1.1 with ASP.net and C#
I'm trying to do something very simple...but I can't figure it out
I have an <asp:button runat="server"> in the test version of my app that is
essentially a backdoor for changing the class of user inside the application
on the fly....it has a textbox next to it
you can type 1, 2, 3, 4 etc.. in the text box and when you click the button
|
by: julian.tklim |
last post by:
Hi,
I need to build an editable Datagrid with add & delete buttons on each
row using javascript.
DataGrid need not be pre-populated with values.
To make the thing complicated, one of the column need to be a date
picker field.
I know things will be easier with ASPX datagrid.
|
by: paulsson |
last post by:
Does anyone know why placing the cursor/focus in a textfield in IE would cause the window.onblur event handler to be called? This seems very odd since the window still has focus....
Is there a way to prevent window.onblur form being called when a textfield in the same window gets focus or to test if the currently focused element is a textfield in window.onblur?
I am testing on IE 6 on WinXP.
Thanks,
Erik
| |
by: Morten Snedker |
last post by:
I'm not that great at reading javascripts.
Instead of doing nothing I'd like to return a Tab-character, if Enter
occurs:
<script language="javascript" type="text/javascript" >
//disable enter-key
function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
|
by: lolly |
last post by:
hi i recently used a virtual keyboard from www.codeproject.com/jscript/jvk.asp.
However this part of the code
function keyb_callback(ch)
{
var text = document.getElementById("textfield"), val = text.value;
switch(ch)
{
case "BackSpace":
|
by: prathna |
last post by:
Hi all,
I would like to know how to pass a form bean value to javascript function to perform some validation..
I have a dropdown list and a textfield.
I have created the dropdown list using html:select tag & the textfield using html:text tag.I have a corresponding formbean with a get/set methods to get/set the dropdown value selected and also for the textfield.now i have onchange attribute in which i call a javascript function.
now how...
|
by: Kid Programmer |
last post by:
Hello guys. I was wondering how you make an event happen when the user presses a key. I have seen code used for this but I don't understand how it works.
Here is the code in a sample I found:
import java.awt.*;
import java.awt.event.*;
public class KeyPress extends Frame{
Label label;
TextField txtField;
public static void main(String args) {
KeyPress k = new KeyPress();
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |