• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1162
  • Last Modified:

500 points --- NIC no. Validation

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
khurram007
Asked:
khurram007
  • 2
1 Solution
 
ZvonkoSystems architectCommented:
NIC is the NetworkInterfaceCard?
Do you check MAC address in hex or do you check IP address in four decimal octets with dots?
0
 
khurram007Author Commented:
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
 
khurram007Author Commented:
Any suggestions???
0
 
devicCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now