473,396 Members | 1,765 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,396 software developers and data experts.

Problem in Validating txtfield

149 100+
hi,
i had done validation in my project...my prob. is if i enter 'AM98' in txtfield it is taking....but it should not take..it has to take 'MA98'...here with i m sending the code...can anyone suggest the solution..its urgent

Expand|Select|Wrap|Line Numbers
  1. chkAct=/^[MA]{2}\d{2}$/;
  2. if (chkAct.test(form.act.value))
  3. {}
  4. else
  5. {
  6. alert('Invalid \"Activation Status\" Entry');
  7. return false;
  8. }
Thanks in advance,
madhu.
Jun 22 '10 #1
2 1082
Dormilich
8,658 Expert Mod 8TB
but you specified the letter portion to be: AM, MA, AA, MM. [MA]{2} means "two times a letter out of M or A" (keyword: character class)

if you want MA exclusively, use
Expand|Select|Wrap|Line Numbers
  1. /^MA\d{2}$/
Jun 22 '10 #2
madhuriks
149 100+
Hi,
thanks a lot...its working perfectly...

Regards,
madhu.
Jun 22 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: mangesh | last post by:
Hi, In the following XML, I need to validate the values provided in Order tag using schema. <?xml version="1.0" encoding="UTF-8"?> <Control...
1
by: Peter B. Ensch | last post by:
Can anyone explain why this code fails when the set of checkboxes consists of only one. myForm.update.length returns 0 instead of 1 with the result that I get an alert box even tho' the one...
12
by: Torbjørn Pettersen | last post by:
I'm having problems validating my HTML code because of some ASP code I'm using: ---Start Code--- <% If rs("Average") = 0 Then VotingImage = "<img src="/images/0.gif" alt='No votes yet'>"...
3
by: Blas Croche Solana | last post by:
Hello, I am trying to validate a VXML document against the new vxml 2.0 schema, and I am getting the following errors (and a lot more like these): Reference to undeclared substitution group...
1
by: Mike P | last post by:
I have a web app that has been running happily for months, and on Saturday it suddenly decided that it no longer wanted to validate my XML. Here is my code and sample schema, and example XML : ...
2
by: Mike Bridge | last post by:
Hi- I've created an XHTML extension module which validates correctly using the W3C online schema validator, but fails when I use the .net 1.1 validator. It seems to be choking on an included W3C...
8
by: David C. Stone | last post by:
I'm stuck trying to validate an html 4.01 page that uses an image map. I copied the second client-side example from here: <http://www.w3.org/TR/html401/struct/objects.html#h-13.6> and...
1
mickey0
by: mickey0 | last post by:
hello, validating this file on w3c I have many error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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
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,...

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.