Contact Us  |  Knowledge Base  |  Control Panel 
Article Details
Create PayPal BuyNow Buttons

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

This is not an official recommendation by the PowerDNN Team.

This is an online workaround.  PowerDNN does 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. But there is a gotcha--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. After doing some research, 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.

Step 1. Remove the 'Form' tags from your PayPal 'BuyNow' code.

Step 2. Add onClick="document.getElementById('Form').action='https://www.paypal.com/cgi-bin/webscr';" to the buy now input button

Step 3. paste all of it into the html module

*****