function checkCSRFEnableSubmit(){
//check for csrf token before enabling form submit button
csrfValue = $("input[type=hidden][name=OWASP_CSRFTOKEN]").size();
if(csrfValue > 0){
//enable button
$("input[type=submit]").prop("disabled",false);
}else{
//check again in next cycle
setTimeout("checkCSRFEnableSubmit()", 1000);
}
}
$(function(){
if ( $("form").size() > 0){
$("input[type=submit]").prop("disabled",true);
checkCSRFEnableSubmit();
}
});
The purpose of the script is to enable submit button in any form only after CSRF Token is obtained.