Jump to content


Photo

text instead of a button


  • This topic is locked This topic is locked
9 replies to this topic

#1 love666

love666

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 11 July 2003 - 11:04 AM

paypal was kind enough to supply me with the following code to replace the image input line:
<a href="#" onclick="submit()">example of text</a>
however when I use it to replace the image input line, and you click on it, nothing happens. is there something else I need to do?

thanks in advance


#2 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 11 July 2003 - 11:33 AM

Well, if that statement works anywhere it is a shortcut and not the normal way. "submit" is a method associated with a FORM, and should be addressed that way.

From within a FORM the format is "this.form.submit();". But this may be used only by elements that are FORM members (<a is not a FORM member!)

You may also submit FORMs from outside a FORM (or from nonFORM members), and in this case the format is "document.formname.submit();", where "formname" is the name you have given the FORM.

In other words, the "submit();" method requires a reference to which FORM it is you want to submit.

Note to remember - using the "submit()" method will not activate the "onsubmit" event handler of the FORM!

Is there something else you need to do? yes. Give the FORM a name, and use the "document.formname.submit()" format.

Ron.

#3 love666

love666

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 11 July 2003 - 11:38 AM

thanks. let me clarify. in the code below, instead of using a paypal donation button, I would like to use text as a link if possible. what would the code be?

thanks again

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="destroy@freerockandroll.com">
<input type="hidden" name="item_name" value="payment for audio files">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.freerockandroll.com">
<input type="hidden" name="cancel_return" value="http://www.freerockandroll.com">
<input type="hidden" name="cn" value="comments">
<input type="hidden" name="cs" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="image" src="https://www.paypal.com/images/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

#4 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 11 July 2003 - 11:38 AM

<form name="myForm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type=hidden name="cmd" value="_xclick">
<input type=text name="business" value="pay@site.com">
<input type=hidden name="item_name" value="Widget">
<input type=hidden name="amount" value="1.00">
</form>

<a href="#" onClick="document.myForm.submit(); return false">Submit</a>

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#5 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 11 July 2003 - 11:44 AM

I understand. Your page must have that FORM somewhere in it. What you want to do is to replace the <input type="image" button with a text ref (<a).

All I am saying is that your <a reference to that FORM (no matter where - inside the FORM or not) needs to be of the format...

<a href="#" onclick="document.formname.submit();">text</a>

where you replace "formname" with a name you have given to the FORM.

Ron.

#6 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 11 July 2003 - 11:51 AM

Yeah - what Patrick said (we were typing at the same time.)

Ron.

#7 love666

love666

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 11 July 2003 - 11:56 AM

thanks, you guys. I've done that - but it still doesn't work:

<form name="myForm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="destroy@freerockandroll.com">
<input type="hidden" name="item_name" value="payment for audio files">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.freerockandroll.com">
<input type="hidden" name="cancel_return" value="http://www.freerockandroll.com">
<input type="hidden" name="cn" value="comments">
<input type="hidden" name="cs" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
</form>
<a href="#" onClick="document.myForm.submit(); return false">Submit</a>

#8 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 11 July 2003 - 12:05 PM

It worked OK for me. Only thing is that you have no amount, but I got to PayPal. Give me a minute and I'll put it up for you...

Here ya go (right-click to see source).

http://members.aol.c...tester/tst1.htm

Ron.

#9 love666

love666

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 11 July 2003 - 12:22 PM

thanks a lot!

#10 Richard Horton

Richard Horton

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 29 April 2004 - 08:13 AM

Hello,

I'm trying to do the same thing (text ilo button for PayPal).

I'm using WordPerfect as my HTML editor (probably my first mistake) and I can get the text "button" to work as long as I don't debug. Once I debug, the stupid program removes the "action="https . . ." from the "form name=" line.

Please help!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users