[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' %>
On 2 sep, 09:38, Erwin <[email protected]> wrote:
> 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-----
> MIIH3QYJKoZIhvcNAQcDoIIHzjCCB8oCAQAxggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVM
> xEzARB….
> 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 ?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.