473,749 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Masked input control (or simulation of)?


I'm currently working on what has turned in to something much
larger that I wanted it to be. The upside is that I'm getting $$ to do
it... but anywho.

I currently have textboxes set up to capture phone numbers,
I've also got regular expression validation in place to force the
format of the number to be (xxx) xxx-xxxx. The problem is, the people
that are paying me don't want this. What they'd like to see is a magic
textbox that fills in the ( ) and - as you type, the other alternative
is 3 separate textboxes.. a 2 that are 3 digits wide and one that is
4.

Doing it with the 3 boxes sounds like the 'easier' way to go,
I can simply concatenate the 3 values together as I see fit before
sending them on to the database... however, if I use this method, they
want the focus to automagically move from box to box as the user
enters the digits.

I'm no javascript person, but assume this is what would be
needed to accomplish the result.

So, my question to all of you is... is there a drop-in masked
control that I can use to replace the textbox, or could someone give
me a hint on how to do the hocus focus thing?

Nov 17 '05 #1
7 1938
Hi,

Here's some JavaScript you might use.

I put three textboxes on a form and added this in the HTML:
<script>
function Box1() {
if (Form1.TextBox1 .value.length > 2)
Form1.TextBox2. focus();
}
function Box2() {
if (Form1.TextBox2 .value.length > 2)
Form1.TextBox3. focus();
}
</script>

You might want to use RegisterClientS criptBlock instead of typing this
directly into the HTML.

Then I added this in the Page_Load
TextBox1.Attrib utes.Add("onkey press", "Box1();")
TextBox2.Attrib utes.Add("onkey press", "Box2();")

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "|{evin" <Yo*@dont.nee d>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Subject: Masked input control (or simulation of)?
Message-ID: <h4************ *************** *****@4ax.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 26
NNTP-Posting-Host: 12.223.101.211
X-Complaints-To: ab***@insightbb .com
X-Trace: attbi_s02 1068511243 12.223.101.211 (Tue, 11 Nov 2003 00:40:43 GMT) NNTP-Posting-Date: Tue, 11 Nov 2003 00:40:43 GMT
Organization: Insight Broadband
Date: Tue, 11 Nov 2003 00:40:43 GMT
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new s-out.cwix.com!ne wsfeed.cwix.co
m!news.umass.ed u!arclight.uore gon.edu!wn13fee d!wn12feed!worl dnet.att.net!20 4
127.198.203!att bi_feed3!attbi_ feed4!attbi.com !attbi_s02.POST ED!not-for-mail Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1898 98
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
I'm currently working on what has turned in to something much
larger that I wanted it to be. The upside is that I'm getting $$ to do
it... but anywho.

I currently have textboxes set up to capture phone numbers,
I've also got regular expression validation in place to force the
format of the number to be (xxx) xxx-xxxx. The problem is, the people
that are paying me don't want this. What they'd like to see is a magic
textbox that fills in the ( ) and - as you type, the other alternative
is 3 separate textboxes.. a 2 that are 3 digits wide and one that is
4.

Doing it with the 3 boxes sounds like the 'easier' way to go,
I can simply concatenate the 3 values together as I see fit before
sending them on to the database... however, if I use this method, they
want the focus to automagically move from box to box as the user
enters the digits.

I'm no javascript person, but assume this is what would be
needed to accomplish the result.

So, my question to all of you is... is there a drop-in masked
control that I can use to replace the textbox, or could someone give
me a hint on how to do the hocus focus thing?


Nov 17 '05 #2
On Wed, 12 Nov 2003 00:11:21 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

Here's some JavaScript you might use.

I put three textboxes on a form and added this in the HTML:
<script>
function Box1() {
if (Form1.TextBox1 .value.length > 2)
Form1.TextBox2. focus();
}
function Box2() {
if (Form1.TextBox2 .value.length > 2)
Form1.TextBox3. focus();
}
</script>

You might want to use RegisterClientS criptBlock instead of typing this
directly into the HTML.

Then I added this in the Page_Load
TextBox1.Attrib utes.Add("onkey press", "Box1();")
TextBox2.Attrib utes.Add("onkey press", "Box2();")

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional


Very similar to something someone else suggested in another group,
altthough this looks a bit cleaner, I am not, however, familiar with
RegisterClientS criptBlock.

Nov 17 '05 #3
Hi,

For more on RegisterClientS criptBlock, please see
Injecting Client-Side Script from an ASP.NET Server Control
http://msdn.microsoft.com/library/en...ectclientsides
c.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "|{evin" <Yo*@dont.nee d>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Subject: Re: Masked input control (or simulation of)?
Message-ID: <u4************ *************** *****@4ax.com>
References: <h4************ *************** *****@4ax.com> <Ry************ **@cpmsftngxa06 .phx.gbl> X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 35
NNTP-Posting-Host: 12.223.101.211
X-Complaints-To: ab***@insightbb .com
X-Trace: attbi_s02 1068600056 12.223.101.211 (Wed, 12 Nov 2003 01:20:56 GMT) NNTP-Posting-Date: Wed, 12 Nov 2003 01:20:56 GMT
Organization: Insight Broadband
Date: Wed, 12 Nov 2003 01:20:56 GMT
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.i cl.net!newsfeed .fjserv.net!log bridge.uoregon. edu!arclight.uo r
egon.edu!wn13fe ed!wn12feed!wor ldnet.att.net!2 04.127.198.203! attbi_feed3!att b
i_feed4!attbi.c om!attbi_s02.PO STED!not-for-mail Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1902 36
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

On Wed, 12 Nov 2003 00:11:21 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

Here's some JavaScript you might use.

I put three textboxes on a form and added this in the HTML:
<script>
function Box1() {
if (Form1.TextBox1 .value.length > 2)
Form1.TextBox2. focus();
}
function Box2() {
if (Form1.TextBox2 .value.length > 2)
Form1.TextBox3. focus();
}
</script>

You might want to use RegisterClientS criptBlock instead of typing this
directly into the HTML.

Then I added this in the Page_Load
TextBox1.Attrib utes.Add("onkey press", "Box1();")
TextBox2.Attrib utes.Add("onkey press", "Box2();")

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional


Very similar to something someone else suggested in another group,
altthough this looks a bit cleaner, I am not, however, familiar with
RegisterClientS criptBlock.


Nov 17 '05 #4
On Wed, 12 Nov 2003 18:42:27 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

For more on RegisterClientS criptBlock, please see
Injecting Client-Side Script from an ASP.NET Server Control
http://msdn.microsoft.com/library/en...ectclientsides
c.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional


I actually found this sometime after midnight last night. I went on to
develop a custom web control that encapsulated the 3 text boxes, the
movement from field to field, a routine that only allows numbers to be
entered into the textboxes, and a custom validator that forces all 10
digits to be entered.

Best of all, the textbox ID's and all of the javascript are generated
on the fly using RegisterClientS criptBlock.. I can place multiple
instances of the control on a web page and everything still gets
hooked up correctly! (although the page source gets a bit large...
there are 6 javascript functions generated for each control).

Thanks a TON!

Nov 17 '05 #5
On Wed, 12 Nov 2003 00:11:21 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

Here's some JavaScript you might use.

I put three textboxes on a form and added this in the HTML:
<script>
function Box1() {
if (Form1.TextBox1 .value.length > 2)
Form1.TextBox2. focus();
}
function Box2() {
if (Form1.TextBox2 .value.length > 2)
Form1.TextBox3. focus();
}
</script>

You might want to use RegisterClientS criptBlock instead of typing this
directly into the HTML.

Then I added this in the Page_Load
TextBox1.Attrib utes.Add("onkey press", "Box1();")
TextBox2.Attrib utes.Add("onkey press", "Box2();")

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional


Well, I thought I had it knocked out. :(

The code that automagically moves the cursor doesn't work with
NetScape 7.

if ( document.all("p cfax_TextBox1") .value.length > 2 )
{
document.all("p cfax_TextBox2") .focus();
}

I've tried replacing with something like

if ( document.getEle mentById("pcfax _TextBox1").val ue.length > 2 )
{
document.getEle mentByIdl("pcfa x_TextBox2").fo cus();
}

But the browser complains that pcfax_TextBox2 has no properties. :(

Is there a cross-browser way to access elements by ID? I've noticed
that a lot of my custom validators do not fire correctly either
because of this same issue.

Nov 18 '05 #6
Hi,

I'm sorry, I don't know the way to do this in Netscape. I recommend that
you try a Netscape oriented newsgroup or chat room. Some can be found at
http://channels.netscape.com/ns/jump...ty/default.jsp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "|{evin" <Yo*@dont.nee d>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Subject: Re: Masked input control (or simulation of) - Cross Browser??
Message-ID: <tt************ *************** *****@4ax.com>
References: <h4************ *************** *****@4ax.com> <Ry************ **@cpmsftngxa06 .phx.gbl> X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 54
NNTP-Posting-Host: 12.223.101.211
X-Complaints-To: ab***@insightbb .com
X-Trace: attbi_s53 1069016964 12.223.101.211 (Sun, 16 Nov 2003 21:09:24 GMT) NNTP-Posting-Date: Sun, 16 Nov 2003 21:09:24 GMT
Organization: Insight Broadband
Date: Sun, 16 Nov 2003 21:09:24 GMT
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new s-out.cwix.com!ne wsfeed.cwix.co
m!news.umass.ed u!arclight.uore gon.edu!wn13fee d!worldnet.att. net!204.127.198 .
203!attbi_feed3 !attbi_feed4!at tbi.com!attbi_s 53.POSTED!not-for-mail Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1912 28
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

On Wed, 12 Nov 2003 00:11:21 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

Here's some JavaScript you might use.

I put three textboxes on a form and added this in the HTML:
<script>
function Box1() {
if (Form1.TextBox1 .value.length > 2)
Form1.TextBox2. focus();
}
function Box2() {
if (Form1.TextBox2 .value.length > 2)
Form1.TextBox3. focus();
}
</script>

You might want to use RegisterClientS criptBlock instead of typing this
directly into the HTML.

Then I added this in the Page_Load
TextBox1.Attrib utes.Add("onkey press", "Box1();")
TextBox2.Attrib utes.Add("onkey press", "Box2();")

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional


Well, I thought I had it knocked out. :(

The code that automagically moves the cursor doesn't work with
NetScape 7.

if ( document.all("p cfax_TextBox1") .value.length > 2 )
{
document.all("p cfax_TextBox2") .focus();
}

I've tried replacing with something like

if ( document.getEle mentById("pcfax _TextBox1").val ue.length > 2 )
{
document.getEle mentByIdl("pcfa x_TextBox2").fo cus();
}

But the browser complains that pcfax_TextBox2 has no properties. :(

Is there a cross-browser way to access elements by ID? I've noticed
that a lot of my custom validators do not fire correctly either
because of this same issue.


Nov 18 '05 #7
On Mon, 17 Nov 2003 19:18:26 GMT, mi****@online.m icrosoft.com ("Mike
Moore [MSFT]") wrote:
Hi,

I'm sorry, I don't know the way to do this in Netscape. I recommend that
you try a Netscape oriented newsgroup or chat room. Some can be found at
http://channels.netscape.com/ns/jump...ty/default.jsp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


Nuts. 95% of this application is used by back-end people. 100% IE. The
other 5% is publicly accessable so I need to get it working at least
there... or redirect them to comebackwithare albrowser.htm.

:)

Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5509
by: metridevkk | last post by:
Hi, I need to use a Masked Edit Control in my ASPX page. In VS.Net, I added the reference to MSMask.dll for my application & also added the MaskEdBox to the Toolbox. After adding the control to the web form, when I select the control & see its properties, I do not see the "Text" property. I also try to set the "Text" property in a javascript function, but cannot access it. Here is the code:
1
2107
by: david | last post by:
Anybody could give me hint how use this control in asp.net web form. The problem is: I try to use COM component in my web form app by using MS training kit for windows form application. I would like to do the similar thing. The guide asks me to add Masked Edit Control to the Toolbox by adding Microsoft Masked Edit Control and I did it. However, there is no Mask property of this edit control box. Another is how declare this control.
1
3478
by: Kostis | last post by:
Hello there! I have created a windows application in VB.NET and I want to retrieve data from an access database. I create the OleDbConnection, an OleDbAdapter, a dataset and finally a Data Form using the Data Form Wizard. Everything works fine. The problem is that I want to use the masked edit control to manage the way some fields appear, and are being stored to the database. I insert the "Microsoft Masked Edit Control, version 6.0" (Path...
3
2610
by: Panos | last post by:
Hi all, I can't clear a Masked edit control. I use it to input dates, so I have defined the mask as "##/##/####". I use the the well known meb.mask="" meb.text="" , but nothing happens. Does anybody have a clue, why these lines don' t work? I use vb.net 2002 Thank u
7
8698
by: DazedAndConfused | last post by:
Curently I manualy code keypress edits. i.e. allow only 3 digits before decimal and two digits after decimal in .NET. Is there an easy solution to mask text boxes? The MSMASK32.OCX from vb6 does not seem to be appropriate for a desktop application with textboxes not bound to a dataset, am I wrong? -- How time fly's when you don't know what you are doing!
0
1027
by: jean-michel bain-cornu | last post by:
Hi all, I'm trying to get the whole field selected when the caret arrives into a wx masked control. This is perfectly done with the program below. But if I comment out the line "r= dlg.ShowModal()", I get something different : the data within the field is no more correctly selected. Why ? And is there any solution ? If somebody have got an idea, I'd be delighted.
3
9137
by: dmbuso | last post by:
I have a money field defined in a SQL Server 05 database with a value of 49.50. Also, it displays in SQL Server as 49.5000. I have a form in VB.NET 2005 and I'm using the new MaskedTextBox control in Visual Studio. I set the Mask property for the text box to "$999.00". The problem is when I run the form the text box displays "$495.00" and not "$49.50" as one would expect. It it shifting the values left here. How do I fix this? Thanks...
2
11354
by: james.czebiniak | last post by:
newbie to .net I have a masked textbox intended to display/input salary. The mask is 999,999 or ###,###. When I place the info from the database into the field it formats incorrectly. The salary is 75000. In the textbox it displays 750,00 What am I doing wrong?? ------------------------------------------------------------------------------------ Posted from WWWCoder.com (http://www.wwwcoder.com - The Web Developer's Resource site.
2
2109
by: gayano | last post by:
Hi, I'm using Visual studio 2005 pro Ver..]]] I have a Form named form1 textbox named txtName masked textbox (Date Masked) named txtMaskedDate and a button to add data named btnAdd dim name as string
0
8832
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,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
tracyyun
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...
0
8256
agi2029
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...
0
6078
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();...
0
4608
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...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.