Author: info@technocore.co.za
Field for South African ID number. Will display an error message('The value is not a valid SA ID number') if the user attempts to submit an invalid number



| Name | Default | Description | Required |
|---|---|---|---|
| Place holder | The value is not a valid SA ID number | specify custom validation message | No |
<input type="text" name="_form_Answer" class="form-control" placeholder="" id="_form_Answer" value="">
<input type="hidden" name="hidden_form_Answer" id="hidden_form_Answer" data-fv-excluded="false" data-fv-notempty="" data-fv-message="The value is not a valid SA ID number" value="" data-fv-field="hidden_form_Answer">
<i class="form-control-feedback fv-icon-no-label" data-fv-icon-for="hidden_form_Answer" style="display: none;"></i>
<script>$( document ).ready(function() {SAID();});document.getElementById('_form_Answer').addEventListener('change', SAID);function SAID(){var idstring = String(document.getElementById('_form_Answer').value);
var component1 = sumParts(idstring.substring(0,12));
var component2 = parseInt(concatParts(idstring.substring(1,12)).replace(/^[0]+/g,"") ) * 2;
var component3 = sumParts(trailZeros(component2.toString(),7).split('').join("0"));
var component4 = component1 + component3;
var Comp = (10 - (component4 % 10 )) % 10;
if (idstring.length > 13)
{
var Check = -1
var result = 0
} else
{
var Check = parseInt(idstring.substring(12,13));
var result = Check === Comp;
}
function trailZeros(value, count)
{
while (value.length < count)
{
value += "0";
}
return value;
}
function sumParts(idstring)
{
var x = parseInt(idstring[0])
+ parseInt(idstring[2])
+ parseInt(idstring[4])
+ parseInt(idstring[6])
+ parseInt(idstring[8])
+ parseInt(idstring[10]);
if (idstring.length > 12)
{
x += parseInt(idstring[12]);
}
return x;
}
function concatParts(idstring)
{
return idstring[0]
+ "" + idstring[2]
+ "" + idstring[4]
+ "" + idstring[6]
+ "" + idstring[8]
+ "" + idstring[10];
}
if(result){document.getElementById('hidden_form_Answer').value = '1';}else{document.getElementById('hidden_form_Answer').value = '';}$('#2BLvge4XaWmsZqFELawpi7').formValidation('revalidateField', 'hidden_form_Answer');}</script>
cythonize -3 -a -i ObjFieldIdentity.py
Compiling /home/axion/projects/axion/factory.field/ObjFieldIdentity.py because it changed..[1/1] Cythonizing /home/axion/projects/axion/factory.field/ObjFieldIdentity.py
Updated : 2025-06-09