[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

500 points --- NIC no. Validation

Posted on 2004-10-18
4
Medium Priority
?
1,100 Views
Last Modified: 2006-11-17
Hi,

I have to validate a text field for a NIC no. which is in a specified format. That is,

x-xxxx-xxxx-x

Can anyone let me know how to validate it for this format as such that only numbers in this format could be submitted for the form.

Thanks,

Khurram.
0
Comment
Question by:khurram007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 12339860
NIC is the NetworkInterfaceCard?
Do you check MAC address in hex or do you check IP address in four decimal octets with dots?
0
 
LVL 2

Author Comment

by:khurram007
ID: 12339980
NIC here is for National Identity Card.

Don't focus on NIC just focus on the format I want in the text box.

Thanks,

Khurram
0
 
LVL 2

Author Comment

by:khurram007
ID: 12340859
Any suggestions???
0
 
LVL 25

Accepted Solution

by:
devic earned 2000 total points
ID: 12340877
easy:
===============
<script>
//x-xxxx-xxxx-x
function checkThis(obj)
{
      if(!obj.value.match(/^\d-\d{4}-\d{4}-\d$/))
      {
            alert("enter right format:x-xxxx-xxxx-x")
      }
}
</script>
<input value="23" onblur=checkThis(this)>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question