close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 | 539 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

Sign in to reply to this post

Jason ByrnesWebAssist

This is a bug in eCart, Ray has done a hot fix update that should fix the problem.

uninstall eCart from the extension manager, then install it again, when you open DW, it should launch the WebAssist installer. If it does not launch automatically, open a php page to force it to launch, after the WA Installer completes, make sure to restart DW. that should install the update to fix the issue.

Sign in to reply to this post

TroyD

Will do.

Thanks,
TroyD

Sign in to reply to this post

TroyD

Jason,

Does that mean I have to delete all the files again and rerun the Wizard...again?
Is there not a way to fix this by hand?

Thanks,
TroyD

Sign in to reply to this post

Jason ByrnesWebAssist

The fix by hand would be to replace the code the being removed.

Sign in to reply to this post

TroyD

Do you mean the code that I noted above that's being removed when I rerun JQ Forms Validation.
Or do I have to delete all my files and recreate them?

TroyD

Sign in to reply to this post

Jason ByrnesWebAssist

either recreate the files using the checkout wizard, or replace the code that was being removed by the bug by hand.

Sign in to reply to this post

TroyD

Ok. I did everything but recreate the pages. Although the code is now no longer being removed, the validation is still being ignored by the Ajax submit of the address form. You can see this in the same example site I sent you the ftp for in my other thread. http://www.webassist.com/forums/posts.php?id=36277

Sorry if I am misunderstanding things here.

See PM.

Thanks,
TroyD

Sign in to reply to this post

TroyD

Jason,

One thing I find that might have been the problem is that the session is different in the middle of the confirm_cart.php page than where it's set for the errors at the top.

I see it as $_SESSION['WAVT_confirmcart_Errors']
Then on the confirm_cart.php page it is $_SESSION['WAVT_confirmphpcart_Errors']

There is an extra "php" in the middle of the reference to the session.
I removed that and it might be working now. Seems so anyway. I've only check this on my local server for that page. I didn't want to change the live site in case you still need to look at it as is.

Thanks
TroyD

Sign in to reply to this post

Jason ByrnesWebAssist

Yeah, that was the problem, i had ray take a look at it and thats what he found too.

should be fixed in eCart if you run the checkout wizard with the new update.

Sign in to reply to this post
loading

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...