SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript Form Submit w/ form_remote_tag

    I am trying to submit a form_remote_tag using javascript instead of a regular form submit button. Here is my code:

    Code:
    <&#37;=
      form_remote_tag(
        :url=> { :controller=>'store', :action=>'add_to_cart_ajax', :id => @product.id, :variation => @variations[i].id },
        :html => {:name => 'add_product_form'},
        :complete => "showPopWin('/store/show_cart', 600, 400, null, true)",
        :failure => 'alert("That item appears to have gone out of stock before you were able to add it to your cart.\n\nPlease refresh this page.")',
        :update => 'items'
      )
    %>
    						
    <div class="buttonTicket" onclick="this.up('form').submit();">Add To Cart</div>
    </form>
    When I click the javascript text to submit the form, the ajax doesn't fire. If I use a regular submit button everything works fine. What am I doing wrong?

    Any help is greatly appreciated!
    Last edited by idledaylight; Jul 9, 2008 at 19:45.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •