How to Make PayPal BuyNow Buttons Work with DotNetNuke
Issue
PayPal BuyNow buttons do not work when pasted into a Text/HTML module.
Cause
Because ASP.NET only allows one html FORM element on the page, PayPal's code conflicts with ASP.NET.
Resolution
Warning: This is not an official recommendation by the support team. This is an online workaround. We do not provide technical assistance for PayPal related questions
PayPal's Button Factory generates HTML markup for Add to Cart and View Cart buttons. The HTML creates a hidden form with the product information PayPal needs to generate the shopping cart. In DNN, one generally puts product pages in Text/HTML modules. However, -DNN doesn't allow forms in Text/HTML modules.
PayPal's suggested workaround is to use an a tag with a query string to pass product data. We decided not to use that approach, because of exposure to potential fraud. We found another workaround on the DNN forums that seems to work well. The workaround comes from John Mitchell, a regular on that forum.
John writes: You can do this with a simple javascript trick.
- Remove the Form tags from your PayPal BuyNow code.
- Locate the following code < input type="image" .
- Directly following that add onClick="this.form.action='https://www.paypal.com/cgi-bin/webscr';this.form.submit();"
- Paste all of it into the html module.
Article ID: 305, Created: April 6, 2012 at 4:00 PM, Modified: August 25, 2014 at 2:25 PM