close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Can't Validate Checkout. Ajax form for addresses is ignoring JQuery Validation

Thread began 1/04/2015 3:01 pm by TroyD | Last modified 1/07/2015 2:13 pm by TroyD | 724 views | 10 replies

TroyD

Can't Validate Checkout. Ajax form for addresses is ignoring JQuery Validation

Since the Billing and Shipping form generated by the Checkout Wizard (Payments Advanced) is an Ajax form, validation is ignored because the address form closes when you click "Continue" no matter what the validation status is.

At first I thought maybe this was an error on my part (still might be) so I created a test site with nothing in it.
1)- Created eCart object and a single static item with Add To Cart.
2)- Then used Checkout Wizard with all basic default settings but used PayPal Advanced for the payment method.

When tested, the Billing and Shipping addresses were left blank, but when I click "Continue" the forms slide up and the PayPal hosted page appears in an iframe.
I see the tooltip error messages for a split second, so I know the validation is happening, but the forms disappear and the buyer is left with the option to go ahead and pay.

What I have tried:
Figuring that maybe the Checkout Wizard generated pages that had some errors and might be causing this, I opened the WA forms JQuery Validation and clicked OK.
For some reason the JQuery Validation window deletes part of the code created by the Checkout Wizard. This causes the constant spinning wheel and "Please Wait…" message that I asked about in this thread. http://www.webassist.com/forums/post/185422/

This is the code at the bottom of the checkout.php page as created by the Checkout Wizard.

<script src="webassist/forms/wa_servervalidation.js" type="text/javascript"></script> 
<script src="webassist/forms/wa_clientvalidation.js" type="text/javascript"></script>
<script src="webassist/forms/WA_SameAs.js" type="text/javascript"></script>
<script src="webassist/jq_validation/jquery.h5validate.js"></script>
<script>
var CheckoutWizard_NewFromBlank_Default_Opts = {
focusout: true,
focusin: false,
change: false,
keyup: false,
popupClass: "Default",
pointedAt: "right",
fieldOffset: -2,
fieldMargin: 0,
position: "left",
direction: "left",
border: 1,
offset: 25,
closeText: "✖",
percentWidth: 100,
orientation: "bottom"
};
function CheckoutWizard_NewFromBlank_Default_Validate() {
$("#CheckoutWizard_NewFromBlank_Default").h5Validate(CheckoutWizard_NewFromBlank_Default_Opts);
}
$(document).ready(function () {
CheckoutWizard_NewFromBlank_Default_Validate()
ConvertServerErrors(CheckoutWizard_NewFromBlank_Default_Opts);
});
</script>
<script src="webassist/framework/javascript/ajax.js" type="text/javascript"></script>
<script type="text/javascript" src="webassist/ecart/checkout/js/paymentoptions.js"></script>
<script>
function framework_load_plugin_url(plugin,form,div,framework_path,on_success) {
framework_ajax_plugin(form,plugin,div,framework_path,false,false,on_success);
return true;
}
var wa_form_id = "CheckoutWizard_NewFromBlank_Default";
var wa_cart_page = "confirm_cart.php";
var wa_framework_path = "";
var wa_confirm_page = "confirm.php";
</script>



And this is what is left after simply clicking OK in the JQ Forms Validation dialog window.

<script src="webassist/forms/wa_servervalidation.js" type="text/javascript"></script> 
<script src="webassist/forms/wa_clientvalidation.js" type="text/javascript"></script>
<script src="webassist/forms/WA_SameAs.js" type="text/javascript"></script>
<script src="webassist/jq_validation/jquery.h5validate.js"></script>
<script>
var CheckoutWizard_NewFromBlank_Default_Opts = {
focusout: true,
focusin: false,
change: false,
keyup: false,
popupClass: "Default",
pointedAt: "right",
fieldOffset: -2,
fieldMargin: 0,
position: "left",
direction: "left",
border: 1,
offset: 25,
closeText: "✖",
percentWidth: 100,
orientation: "bottom"
};
function CheckoutWizard_NewFromBlank_Default_Validate() {
$("#CheckoutWizard_NewFromBlank_Default").h5Validate(CheckoutWizard_NewFromBlank_Default_Opts);
}
$(document).ready(function () {
CheckoutWizard_NewFromBlank_Default_Validate()
ConvertServerErrors(CheckoutWizard_NewFromBlank_Default_Opts);
});
</script>



As you can see, it removes the reference to ajax.js and paymentoptions.js and the framework function.

I really think two things are at play here. One is that JQuery Forms Validation is conflicting with the code created by the Checkout Wizard. And secondly, the code that is suppose to block the form from being submitted if it doesn't validate is not working with the Ajax since the same action also closes the address forms.

Any thoughts on this? I have this on my local test server or I would include a URL. This was a new generic shopping cart in an empty site with no other code added.

Thanks,
TroyD

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...