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

  • SEARCH
  • Home
  • 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 8108367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:05:19+00:00 2026-06-06T01:05:19+00:00

I have the following form and controller. <%= form_tag do %> <div> <%= label_tag

  • 0

I have the following form and controller.

<%= form_tag do %>
    <div>
        <%= label_tag :Old %>
        <%= password_field_tag :old_password %>
    </div>

    <div>
        <%= label_tag :New %>
        <%= password_field_tag :new_password %>
    </div>

    <div>
        <%= label_tag :Confirm %>
        <%= password_field_tag :confirm_password %>
    </div>

    <div>
        <%= submit_tag "Update" %>
    </div>
<% end %>

and the controller:

def change
    @user = current_user
    @op = params[:old_password]
    @np = params[:new_password]
    @cp = params[:confirm_password]

    if @np == @cp
        @user.update_with_password(:password => @np, :current_password=>@op)

        if @user.save
            flash[:notice] = "Password Successfully Changed"
            redirect_to home_path
        end 
    else
        @user.errors.add("Incorrect confirmation")
    end
end

This is all tied to ‘password/change’ in the config/routes.rb

The problem is that when I go to /password/change I immediately an redirected to home and receive the “password successfully changed” flash notice. What I take from it is that it is not requiring me to click the submit button in order to pass the parameters. How do I make it so that it waits for the submission of the form before continuing through the controller?

  • 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-06T01:05:20+00:00Added an answer on June 6, 2026 at 1:05 am

    The problem is that you need 2 separate methods. One to show the view and one to handle the form post.

    Right now the “change” method in your password_controller is handling the form post so you need a method like “index” to show the form

    def index
        #move your form to /views/password/index.html.erb or specifically render your 'change' view
    end
    

    Then in your markup add the action to your form

    <%= form_tag('/password/change') do %>
    …
    

    Then in your controller you can specify POST only for the change method

    class PasswordController < ApplicationController
        verify :method => :post, :only => :change
    …
    

    UPDATE

    Instead of using the verify method (removed in rails 3) you should either set up your route to be restful (Rails Routing from the Outside In) or you can create a specific route for changing the password like so:

    match 'password/change' => 'password#change', :via => :post
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following form in my /app/views/password_resets/new.html.erb view <% form_tag password_resets_path do %>
I have the following code: // Form the continuities list string[] continuities = new
I have the following line of haml: =form_tag :action => 'create', :controller => 'comments',
I have the folowing gsp page: <g:form controller=?? action=??> <h1>Search</h1> <g:submitButton name=search value=Search/> <div
Environment: Rails 3.0.4 and Ruby 1.9.2 I have the following form: <%= form_tag( {:action
I have the following form, which I have reduced as much as I can,
I have the following form for photo_album which uses the nested forms feature of
I have the following form <form name=myForm id=myForm method=post enctype=multipart/form-data action=script.php> and this jQuery
I have the following form code: # forms.py class SomeForm(forms.Form): hello = forms.CharField(max_length=40) world
i have the following form item { fieldLabel:'Username' ,id:username ,name:'username' ,allowBlank:false ,plugins:[Ext.ux.plugins.RemoteValidator] ,rvOptions: {

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.