在贝宝简单结帐之前验证表格 [英] validating form before paypal simple checkout
问题描述
我在我的网站上有一个简单的付款表格,可以选择使用贝宝快速结帐付款. 我的表单的其余部分已通过jquery验证进行了验证.
I have a simple payment form on my website with an option to pay with paypal express checkout. The rest of my form is validated with jquery validation.
当您单击贝宝按钮时,如何设置它?它应该在允许贝宝弹出窗口打开之前验证表单?
How can I set it up when you click the paypal button, it should validate the form before allowing the paypal popup to open?
$("#form1").validate();
我有一个简单的Paypal渲染脚本
I have a simple paypal render script
<script>
paypal.Button.render({ ...
在Paypal文档中,他们提供了类似的内容,但我不知道如何将两者结合起来
On the paypal documentation they offer something like this, but I don't know how to combine the 2
validate: function(actions) {
.....
},
推荐答案
这里有完整的示例:
https://developer.paypal.com/demo/checkout/# /pattern/validation
在validate()函数中,您需要侦听表单的更改并启用/禁用按钮.
In the validate() function you need to listen for the form changing and enable/disable the button.
这篇关于在贝宝简单结帐之前验证表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!