DotNetNuke Powered!
          
John Mitchell's (mostly DotNetNuke) Blog - HowTo: put PayPal Buy Now buttons in your DotNetNuke Portal
 Thursday, November 09, 2006
You can do this with a simple javascript trick.

Step 1. Remove the <Form> </Form> tags from your PayPal "Buy Now" code.

Step 2. Add 
          onClick="this.form.action='https://www.paypal.com/cgi-bin/webscr';   
                      this.form.submit();" 

      to the buy now input button.

Step 3. Paste what is left into the html module
 
What it does is change the action for the Form that is already embedded into the DotNetNuke default.aspx page.


Here is an an example:
 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="payments@snapsis.com">
<input type="hidden" name="item_name" value="Buy John a Beer">
<input type="hidden" name="item_number" value="Beer">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image"
   onClick="this.form.action='https://www.paypal.com/cgi-bin/webscr';this.form.submit();"
src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
You can find more advanced ideas in this thread on the asp.net forums.
11/9/2006 5:47:57 PM (Central Standard Time, UTC-06:00)  #    Comments [4]
3/28/2007 4:14:40 AM (Central Standard Time, UTC-06:00)
Hi John

I was wondering if you had any idea on how to do tis with paypal subscriptions?

Thanks this has been a great help and when I get paid I will be putting some cash in the buy John a beer fund ;)

Mike
3/29/2007 9:45:46 AM (Central Standard Time, UTC-06:00)
Hi Mike,

It should work the same with subscriptions. You will just have different information in the hidden fields. If there is something I am missing, lets continue the discussion over in my forums. Http://www.snapsis.com/DotNetNuke-Support-Forums.aspx
5/9/2007 8:03:55 AM (Central Standard Time, UTC-06:00)
Thanks for this post! It really helped me out of a jam.

I wasn't trying to get a PayPal button on our site, but was having issues with creating a simple javascript form drop down menu navigation. It was working in Firefox, but caused all sort of problems with IE. Until I read your post, I didn't realize that my site was already surrounded by a form. I removed the form tags around my drop down menu, and it works!
5/6/2008 11:03:21 AM (Central Standard Time, UTC-06:00)
Hi John,

Thanks for this post! I need some help. I am trying to integrate my site with my CRM tool but the form post even with the changes you suggest will not actually post to the crm nor will it return to my portal. I will send you an email with the web-to-lead code if you want to take a look... I have been fooling around with this all weekend so any help would be greatly appreciated.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):