disable, enable and onclick functions do not work PayPal's Pay button

Telomeraz
New Community Member

I have a form that must be valid before clicking "Pay Now" button.I want to keep the button disable until the form is valid.

 

There is some issues about it. There is a link about "onClick" function.It's working but when I click "Pay now" button, inside of the onClick buttons work and also payment keeps working I mean there is no way to cancel by me for an invalid form.Actually onClick function has no effect to payment side.

There are also different solutions like "actions.disable()" and "actions.enable()" but these functions do not work at all.

There are also "actions.resolve()" and "actions.reject()" functions but they do not work as well.

Here is the link about onClick, resolve and reject functions: https://developer.paypal.com/docs/checkout/integration-features/validation/#asynchronous-validation

Here is the link about disable and enable functions: https://developer.paypal.com/docs/checkout/integration-features/validation/#synchronous-validation

I really did not understand that how they can make doc about them that don't work

Login to Me Too
1 REPLY 1

mzvarik
Contributor
Contributor

It seems that you have to do this:

It's really annyoing.

 

validate : function(actions) {
t.paypalActions = actions; // store the actions
t.paypalActions.disable(); // disable by default

//--- MAKE EVENT THAT WILL PERIODICALLY CHECK YOUR FORM ON EVERY CHANGE AND MAKE THE BUTTONS ENABLED / DISABLED PRIOR TO USER CLICKING
},

onClick: function(data) {
// when this is called, it is already too late to allow / disable the action!!

}

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.