Hi
After all, I realize that I still have issues with this.
My jquery, etc, as mentioned, is being loaded after the page load
PHP Code:
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "<?php echo DIR_WS_TEMPLATE.'jscript/'; ?>tpl_v02.js";
document.body.appendChild(element);
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
For whatever reason I now realize that formPassed = check_form(); is not getting defined.
This is the zencart file
PHP Code:
$(document).ready(function(){
$('form[name="checkout_payment"]').submit(function() {
$('#paymentSubmit').attr('disabled', true);
<?php if ($flagOnSubmit) { ?>
formPassed = check_form();
if (formPassed == false) {
$('#paymentSubmit').attr('disabled', false);
}
return formPassed;
<?php } ?>
});
To this what I did now:
PHP Code:
// In \includes\modules\pages\checkout_payment\jscript_main.php
<?php
if ($flagOnSubmit) { ?>
var flagOnSubmit = 1;
<?php } ?>
// Portion of this file is loaded on the footer cause jquery
The document.ready
PHP Code:
if (document.body.id === 'checkoutpaymentBody') {
$('form[name="checkout_payment"]').submit(function () {
$('.paymentSubmit').attr('disabled', true);
if (flagOnSubmit === 1 && check_form() === false)
{
//document.getElementsByClassName ('payment')
$('.paymentSubmit').attr('disabled', false);
}
console.log(check_form + 'check_form');
return check_form();
});
}
In chromes console check_form() returns true.
Am I doing this right ?