Page 1 of 1
Checkout Confirmation
Posted: Wed Dec 14, 2016 3:06 am
by ajackson
My company is trying to write a javascript confirmation check on the "Pay with Card" button on the opc.aspx checkout page(one page checkout option selected). We want to have the user confirm that they want to follow through with the transaction. The button already has a script written on the "OnClientClick" attribute that prevents user from submitting order twice. Is there a way to do this without removing the functionality for submitting the order twice. Any help on this will be appreciated.
Re: Checkout Confirmation
Posted: Wed Dec 14, 2016 11:09 pm
by mazhar
Simply edit ConLib/Checkout/PaymentForms/CreditCardPaymentForm.ascx file and then update following code responsible to stop form re-submission.
Code: Select all
CreditCardButton.OnClientClick = "if (Page_ClientValidate('" + this.ValidationGroup + "')) { this.value='Processing...';this.onclick=function(){return false;}; }";
to something like this
Code: Select all
CreditCardButton.OnClientClick = "if (Page_ClientValidate('" + this.ValidationGroup + "') && getConfirmation()) { this.value='Processing...';this.onclick=function(){return false;}; }";
Finally in your ascx file you need to add a javascript method for your confirmation code.
Code: Select all
<script>
function getConfirmation() {
return confirm("Are you sure you want to proceed with payment?");
}
</script>