I am trying to use an encrypted request to PayPal using my own submit
button link
I googled a little but, but could not find a clear & neat solution, so
I ended writing this :
== Rails 2.3.8 script code ====
...
<% form_tag APP_CONFIG[:paypal_url], {:id => 'form_paypal'} do %>
<%= hidden_field_tag :cmd, "_s-xclick" %>
<%= hidden_field_tag :encrypted, @cart.paypal_encrypted(root_url,
payment_notifications_url(:secret => APP_CONFIG[:paypal_secret])) %>
<p><%= link_to_function "OK", "$('form_paypal').submit()" , :class
=> 'buy' %></p>
<% end %>
...
=====
The display is fine (I get my button..), the generated code seems ok,
but when I hit the button, nothing happen......
=== generated source code ====
...
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr"
id="form_paypal" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden"
value="hswuJS6f7BRIcPx5zWDcxkQwX6JiFPGC/XxgGf5vyzM=" />
</div>
<input id="cmd" name="cmd" type="hidden" value="_s-xclick" />
<input id="encrypted" name="encrypted" type="hidden" value="-----BEGIN
PKCS7-----
MIIH3QYJKoZIhvcNAQcDoIIHzjCCB8oCAQAxggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARB….
5l/cKPVZW2/h9QPBq44h
+F948cJ3lgAgQnSAACqkmxGWugL9v5MC8Nh3JtSrnvPCfINGQl8zWDIz74bM+
+au4g==-----END PKCS7-----" />
<p><a class="buy" href="#" onclick="$('form_paypal').submit(); return
false;">OK</a></p>
</form>
where am I wrong ?
on 2010-09-02 09:40
on 2010-09-02 09:56
[SOLVED] I realized that I was using jQuery and not Prototype
anymore ..
so the link_to function was not right and should have been written
with the correct jQuery id # : ('#form_paypal').submit()
<%= link_to_function "OK", "$('#form_paypal').submit()" , :class =>
'buy' %>
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.