Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7770583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:26:35+00:00 2026-06-01T16:26:35+00:00

I want to swap out: <%= button_tag Create , :class => round %> for

  • 0

I want to swap out:

   <%= button_tag "Create" , :class => "round" %>

for

  <%= link_to trips_path(@trip),  :class => "round", :method => :post do %>
    <div id="createtrip_button_newtrip">
      Create
    </div>
  <% end %>

in the form

<%= form_for @trip, :html =>{ :multipart => true} do |f| %>


  <div class="field">
    <%= f.label :name %><br/>
    <%= f.text_field :name  %>
  </div>
  <div id="description_container_newtrip">
    <%= f.label :description %><br/>
    <%= f.text_area :description %>
  </div>
  <div class="field">
    <%= f.label :location %><br/>
    <%= f.text_field :location %>
  </div>

  <div class="field">
    <%= f.label :start_date, "Start Date:" %><br/>
    <%= f.date_select :start_date, :order => [:month, :day, :year]   %>
  </div>
  <div class="field">
    <%= f.label :end_date, "End Date:" %><br/>
    <%= f.date_select :end_date, :order => [:month, :day, :year] %>
  </div>
  <div class="field">
    <%= f.hidden_field :user_id %>
  </div>
  <div class="field">
    <%= f.hidden_field :traveldeal_id %>
  </div>

  <%= #button_tag "Create", :class => "round" %>


  <%= link_to trips_path(@trip),  :class => "round", :method => :post do %>
    <div id="createtrip_button_newtrip">
      Create
    </div>
  <% end %>

<% end %>

The link_to calls the correct action in the correct controller, but my form isn’t saving. Here is the method:

  def create
    @trip = Trip.new(params[:trip])
    if @trip.save
      redirect_to root_path
    else
      redirect_to login_path
    end
  end

I keep getting redirected to the login_path. I think my problem is that I’m not sending the parameters of @trip over to the controller.

Any tips?

Edit:

Here is the params hash from my development log:

Started POST "/trips" for 127.0.0.1 at 2012-04-07 15:23:37 -0700 Processing by TripsController#create as HTML Parameters: {"authenticity_token"=>"+D2icFw2pz6qwYVaeXoWg5MOJg+Sks5/ckN0lVn1r4o="} [1m[36m (0.1ms)[0m [1mbegin transaction[0m [1m[35m (0.0ms)[0m rollback transaction Redirected to http://localhost:3000/login Completed 302 Found in 2ms (ActiveRecord: 0.1ms)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:26:36+00:00Added an answer on June 1, 2026 at 4:26 pm

    I think the problem is that your link_to doesn’t affect the form. You can fix this with a bit of javascript:

    $(".submit_link").click(function(){
      var link = $(this);
      var form = link.closest("form");
      form.submit();
      return false;
    });
    

    And then add the class submit_link to your link.

    If you don’t want javascript, use a submit_tag, and style it with CSS. For some tips on going that route, see here: http://cssbutton.com/forms/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div id (auctions), and I want to swap out the HTML
I want to swap out one view with another by pushing the old view
Suppose we have the following code. I want to swap out the inner parse_place
I want to have an IDataService that I can then swap out with a
I have a text below where I want to swap out the login link,
I want to swap two integers, and I want to know which of these
I want to swap two fragment in an activity via animation.Suppose PageA is for
We want to swap in changes and would like to avoid having to restart
In most languages, if you want to swap two variables, it's something like: var
I want to develop JSF page which can display the swap size if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.