TuxedoTomson
TuxedoTomson

Reputation: 483

Rails form submitting without some params

my form is submitting without params in "Customer Information" and "Shipping Information". The form is rendered in a modal and looks like this

        #formShipping.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "productShippingLabel", :role => "dialog", :tabindex => "-1"}
      .modal-dialog
        .modal-content
          .modal-header
            %button.close{"data-dismiss" => "modal", :type => "button"}
              %span{"aria-hidden" => "true"} ×
              %span.sr-only Close
            %h4#myModalLabel.modal-title Payment Form
          .modal-body
            / Button trigger modal
            .hide-info
              .panel.panel-default
                .panel-heading Customer Information
                .panel-body
                  .col-md-3
                  .col-md-6
                    %label{:for => "email"} Email Address
                    %input.form-control{:type => "text"}/
                    %label{:for => "name"} Name
                    %input.form-control{:type => "text"}/
                    %label{:for => "password"} Password
                    %input.form-control{:type => "text"}/
                    %label{:for => "password-confirmation"} Password confirmation
                    %input.form-control{:type => "text"}/
                  .col-md-3
            .panel.panel-default
              .panel-heading Shipping Address
              .panel-body
                .col-md-6
                  %label{:for => "name"} Name
                  %input.form-control{:type => "text"}/
                  %label{:for => "city"} City
                  %input.form-control{:type => "text"}/
                  %label{:for => "zipcode"} Zipcode
                  %input.form-control{:type => "text"}/
                .col-md-6
                  %label{:for => "address"} Address
                  %input.form-control{:type => "text"}/
                  %label{:for => "state"} State
                  %input.form-control{:type => "text"}/
                  %label{:for => "country"} Country
                  %input.form-control{:type => "text"}/
            .panel.panel-default
              .panel-heading
                %h3.panel-title Card information
              .panel-body
                .row
                  .col-md-6
                    %label{:for => "name"} Card Number
                    %input.form-control{:type => "text", "data-stripe" => "number"}/
                  .col-md-3
                    %label{:for => "name"} CVC
                    %input.form-control{:placeholder => "Ex. 331", :type => "text", "data-stripe" => "cvc"}/
                  .col-md-3
                    = label_tag :card_month, "Expiration"
                    = select_month nil, {add_month_numbers: true}, {name: nil, id: "card_month", "data-stripe" => "exp-month"}
                    = select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year", "data-stripe" => "exp-year"}
                .text-center
                  %h2.total-amount
                    Total:
                    $0.00
                  %input{:name => "terms", :type => "CHECKBOX"}>/
                  Agree to terms?
                  %br/
                  %br
                %span.payment-errors
                %input{:name => "store_front", :type => "hidden", :value => @store_front.id}/
                .text-center
                  %button.btn.btn-primary{:type => "submit"} Pay Now!
          .modal-footer
            %button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close

My stripe params come through just fine. But this is the result of checking my submitted params:

>> params
=> {"utf8"=>"✓", "authenticity_token"=>"xkgz3HdfwqS0/AfKpQteT1FaJE/LMhMneUKETCug47qhlw=",    "order_products"=>[{"product_id"=>"37", "quanity"=>"0"}, {"product_id"=>"38", "quanity"=>"1"}], "switchName1"=>"on", "custom-amount"=>"", "store_front"=>"34", "stripeToken"=>"token", "action"=>"create", "controller"=>"orders"}

Does anyone know why my inputs aren't submitting?

Upvotes: 0

Views: 63

Answers (2)

anusha
anusha

Reputation: 2135

You have specified you field for lable but not your input so add that

 %label{:for => "email"} Email Address
 %input.form-control{:email, :type => "text"}/

Upvotes: 1

Groyoh
Groyoh

Reputation: 342

You've forgotten the name attribute for each one of your input elements.

Change:

%input.form-control{:type => "text"}/

to:

%input.form-control{:type => "text", :name =>"email"}/

and set the correct value for each one of your elements.

Upvotes: 1

Related Questions