Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am develop political site, so i need validation of voter id in my project.
Posted
Updated 22-May-20 22:41pm
Comments
Prasad Avunoori 14-Feb-14 3:43am    
You would need a Webservice/WCF service which is provided by Chief Election Officer of Your country.
Ahmed Bensaid 14-Feb-14 4:01am    
Do you know all the forms that can be take by this id ?
Member 10596107 15-Feb-14 2:35am    
http://erms.gujarat.gov.in/
Ahmed Bensaid 15-Feb-14 8:48am    
If you know the exact form that can take this voter id, you should use a regular expression to validate it.
What have you tried? What is the format of voter id in your country?
Please research and come out with some code.

1 solution

function validateVoterID(ths) {
    var inputvalues = $(ths).val();
    var regex = /^([a-zA-Z]){3}([0-9]){7}?$/g;
    if (!regex.test(inputvalues)) {
        $(ths).val("");
        $(ths).parent().append('<span class="error">Invalid Voter ID Number</span>');
        return regex.test(inputvalues);
    } else {
        $(ths).parent().find(".error").remove();
        return true;
    }
}

<input type="text" name="voter_IDno" class="form-control" onchange="return validateVoterID(this)" placeholder="Enter Voter ID Number" maxlength="10">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900