I have a product page with an add to cart button
When the add to cart button is clicked, a couple of input fields are validated using ASP.NET validation controls (which use client-side validation to prevent the postback from occurring upon invalid input).
In order to prevent double-clicks from adding multiple items to the cart, I would like to disable the add to cart button after the initial click, but ONLY if validation has succeeded. (It would be rather bad to disable “add to cart” just because they goofed up an input)
Is it possible to handle the “on ASP.NET client-side validation succeeded” event in javascript?
I may just end up rolling my own validation mechanism for this page.
Just an example, but you can adopt this to your needs:
Markup:
Script: