Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"KTP INA Verification with date"
Bootstrap 3.0.0 Snippet by
elkhunsu
3.0.0
Preview
HTML
JS
View Full Screen
Fork
Fork this
2.8K
 
0 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <form class="form-horizontal application-form"> <fieldset> <!-- Form Name --> <legend>Form Name</legend> <!-- Multiple Radios --> <div class="form-group"> <label class="col-md-4 control-label" for="radios">Multiple Radios</label> <div class="col-md-4"> <div class="radio"> <label for="gender1"> <input type="radio" name="radios" id="gender1" value="male" checked="checked"> MALE </label> </div> <div class="radio"> <label for="gender2"> <input type="radio" name="radios" id="gender2" value="female"> FEMALE </label> </div> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="identification_number">KTP</label> <div class="col-md-5"> <input id="identification_number" name="identification_number" type="text" placeholder="ktp number" class="form-control input-md" required="" data-odd> <span class="help-block">Input KTP number</span> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="date_of_birth">dob</label> <div class="col-md-4"> <input id="date_of_birth" name="date_of_birth" type="text" placeholder="DD/MM/YYYY" class="form-control input-md"> <span class="help-block">date of birth</span> </div> </div> <!-- Button --> <div class="form-group"> <label class="col-md-4 control-label" for="singlebutton"></label> <div class="col-md-8"> <button id="apply" name="singlebutton" class="btn btn-primary">Apply</button> </div> </div> </fieldset> </form>
$('.application-form').validator({ custom:{ 'odd' : function($el){ var matchValue = $el[0].value // foo return ktpValidator(matchValue); } } }).on('submit', function(){ if (tindakan.isDefaultPrevented()) { //prevent from submission } else { alert('sukses'); } }); function ktpValidator(matchValue){ var ktpVal = $("[name='identification_number']").val(); if(ktpVal.length === 16 && ktpVal === matchValue){ var dob = $("[name='date_of_birth']").val().split("/"); var cekDateID = $("input[name='gender']:checked").val() === 'female' ? parseInt(dob[0]) + 40 : dob[0]; var dobResult = String(cekDateID).concat(dob[1], dob[2].slice(2)) var dateKtp = ktpVal.slice(6, 12); if(dobResult !== dateKtp){ return "Data KTP Anda Tidak Valid"; } } else { return "Input KTP 16 Digit Anda"; } }
Related:
See More
Template
Now UI Kit PRO
76.6K
83
Fast Selection Date Picker
82.7K
81
Responsive Date Paginator
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76