I am trying to load a payment form within a model within a rail form. As of now, when I click on "Buy Now", the model will load, but the form will be submitted. How do I submit it, unless someone clicks on "submit" in "model"?
= form_tag foo_path, id: 'pay-form' - if @ store.products == zero test - @ store.products.each_with_index do | Product, index | .row - .col-lg-2 - if current_user - if store.user_id == current_user.id = link_to "delete", product_path (product), data: {method: "delete", confirm: "Are you sure ? "} .col-lg-8 .panel.panel- default.panel- body .row .col-lg-2% Input {: type = & gt; "Checkbox",: id = & gt; "SwitchNAM # {index}",,: class = & gt; "Check"} /% label {: for = & gt; "SwitchName # {index}"} .col-lg-8 = hidden_field_tag ("order_products [] [product_id]", product.id) = product.name% br.subheader = number_to_currency (product.cost_in_cents.to_f / 100) ). Col-lg-2 = select_tag ("order_products [] [quanity]", options_for_select ([0,1,2,3,4,5,7,8,9,10,11,12,13,14,14, 15]), "data-cost-per-unit" => productcost_incents, id: product.name, class: "drop" ,:productx => index.col-lg-2-current_user -sahi% Period . Payment errors Text-center% h2 Total: Total: $ 0.00% Hour Text-Center% Button BTN BTN-Primary BTN-LG {"Data-Target" = & gt; "#memold", "data-toggle" = & gt; "Model"} Buy now
By default, on a & lt While clicking; Button & gt; The form containing the
element has been submitted :.
If you select {"data-target" => gt; "#memold", "data-toggle" = & gt; "Model", "Type" = & gt; "Button"}
When creating your button, it should display its model without submitting a form.
Then, you have to submit the form to your model, if you want it to be what it is.
Comments
Post a Comment