473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Filtering form data.

Good day to all.

I have this problem in JavaScript. I have a form (textbox) which
accepts a series of numbers in format 9999-9999-9. Now i want to
filter all inputs to the textbox. let's say 1234-1234-1 is a valid
input, 12345-123-2 is an invalid input. I had a sample in filtering
email address. I used a filter on that one.

Hope anyone in the group can help me in my problem.
Jul 23 '05 #1
3 2021
Aionius wrote:
Good day to all.

I have this problem in JavaScript. I have a form (textbox) which
accepts a series of numbers in format 9999-9999-9. Now i want to
filter all inputs to the textbox. let's say 1234-1234-1 is a valid
input, 12345-123-2 is an invalid input. I had a sample in filtering
email address. I used a filter on that one.

Hope anyone in the group can help me in my problem.


If you want to require ####-####-#, the simplest way is 3 input boxes,
and you insert the dashes where you want them. Or, just one input box
that allows 9 digits, then you split it like you want.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
JRS: In article <31**************************@posting.google.com >,
dated Thu, 19 Aug 2004 16:02:04, seen in news:comp.lang.javascript,
Aionius <ai*****@hotmail.com> posted :
I have a form (textbox) which
accepts a series of numbers in format 9999-9999-9. Now i want to
filter all inputs to the textbox. let's say 1234-1234-1 is a valid
input, 12345-123-2 is an invalid input.


/^\d\d\d\d-\d\d\d\d-\d$/

<URL:http://www.merlyn.demon.co.uk/js-valid.htm>

If the data is supplied and used elsewhere as dddd-dddd-d, then it will
be easier for the operative to insert it in that form; I would not
choose to split it into three boxes.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3
Aionius wrote:
I have this problem in JavaScript. I have a form (textbox) which
accepts a series of numbers in format 9999-9999-9. Now i want to
filter all inputs to the textbox. let's say 1234-1234-1 is a valid
input, 12345-123-2 is an invalid input. [...]


if (/^\d{4}-\d{4}-\d$/.test(inputStr))
{
// valid input
}
else
{
// invalid input
}
PointedEars
--
Better living through chemistry...
Jul 23 '05 #4

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

Similar topics

1
by: Spike | last post by:
I'm trying to filter data from a database called "G63" to give a single result based on two filtering criteria. The problem is I can only get the result of one filter at a time, as shown in the...
3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
0
by: Keith Shearer | last post by:
I'm having a bit of trouble, moving between controls, when filtering on a form. I'm using a continuous form. At the top I have 2 date fields. I want to filter the data specified between the two...
5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
0
by: Scott Loupin | last post by:
I've got two databases with similar data in them (WestSide and EastSide). I've set up two identical reports that is filtered by date and the client name. I'm using one form to do the filtering. ...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
2
by: Jason Huang | last post by:
Hi, I use the ReadXML method in my C# Windows Form project. Here is some of my C# code: xmlDS.ReadXml(curDir + "\\Dept.xml") ; There're 20 rows and 5 columns in the Dept.xml. But now I just...
0
by: Lyn | last post by:
I have a problem using the form .Filter and .FilterOn properties which causes Access to crash (as detailed in a separate post). The form operates in continuous mode, displaying matching records...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a ListBox on my form with lots of data in it (14000 entries). I have to put a search field on the form. As text is entered into the search field, I want the ListBox to remove entries...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
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...

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.