I need urgent help with showing a submit button after a jquery validator script ran.
I have a basic form where people insert their South African ID. The script runs and then shows the result in a div. If the ID No is valid, the proceed button must be enabled. If it is not valid, the proceed button must remain disabled.
Ok dont know if i got the time to help get to the answer
But couple of things …
I added this to help me debug and see could i find out how to do what you want
var _input = $('input');
_input.keyup(function(){
debugger;
validateSubmitButton(checkIDValid())
})
added it just before the closing bracket of you document ready Function.
so first problem is
function checkIDValid(){
var answer = document.getElemenstById("id_results").value[0];
getElementsById … should be getElementById … remove the s
secondly .value[0] is wrong
Ok got it working but you might need to tweek it
Just go through the code below and make the changes i made or just copy and paste into pen … just keep a copy of your original in case of error … but working for me
$().ready(function() {
$('#idno').rsa_id_validator({
displayValid: [true,"IDNo Valid","IDNo InValid"],
displayDate: [true,""],
displayAge: [true,"AGE:"],
displayGender: [true,"Male","Female"],
displayCitizenship: [true,"Citizenship: South African","Citizenship: Foreign Citizenship"],
});
var _input = $('input');
_input.keyup(function(){
debugger;
validateSubmitButton(checkIDValid())
})
});
//no idea what to do here
function checkIDValid(){
var answer = document.getElementById("id_results");
if (answer.childNodes[0].data === "IDNo Valid") {
return true;
}
}
function validateSubmitButton (checkIDValid) {
if(checkIDValid == true) {
$('#valid-button').removeAttr('disabled');
} else {
//alert("ID No not correct!")
}
}