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 7489225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:13:02+00:00 2026-05-29T15:13:02+00:00

Here is the form: <%= form_tag({:controller => home, :action => tellafriend}, :method => post,

  • 0

Here is the form:

      <%= form_tag({:controller => "home", :action => "tellafriend"}, :method => "post", :class => "well form-horizontal") do %>
          <div class="control-group">
            <label class="control-label" for="input01">Your name:</label>
            <div class="controls">
              <input id="name" class="input-xlarge" type="text"/>
              <p class="help-block">Type in your name so your friends know you sent this.</p>
            </div>
          </div>

          <div class="control-group">
            <label class="control-label" for="input01">Friends email address:</label>
            <div class="controls">
              <input id="emails" class="input-xlarge" type="text"/>
              <p class="help-block">Who do you want to send this to? Separate different emails with a comma.</p>
            </div>
          </div>

          <div class="control-group">
            <label class="control-label" for="input01">Message:</label>
            <div class="controls">
              <textarea id="message" class="input-xlarge" type="text" rows="7"></textarea>
              <p class="help-block">Attach a special message your friends will read.</p>
            </div>
          </div>
          <button class="btn tell-a-friend-submit" type="submit">Send</button>
        <% end %> 

And my Controller:

class HomeController < ApplicationController
  def index
  end

  def tellafriend
    @name = params[:name]
    @emails = params[:emails]
    @message = params[:message]
  end  
end

And in my Routes configuration file:

post "home/tellafriend"

And finally, my View:

<p><% @name %></p>

Why isn’t the value I enter in “name” shown in the View?

And I see this in my console when I do the POST:

Started POST “/home/tellafriend” for 127.0.0.1 at 2012-02-12 14:16:10
-0400 Processing by HomeController#tellafriend as HTML

Parameters: {“utf8″=>”✓”,
“authenticity_token”=>”2N1jNQ30cXCU4YANQ3FEZFBBTNhKobCQUwj1rEZ3Mxw=”}

Rendered home/tellafriend.html.erb within layouts/application (0.0ms)
Completed 200 OK in 20ms (Views: 11.9ms | ActiveRecord: 0.0ms)

Does this mean my values aren’t being posted? Suggestions?


Edit:

Added in the name attribute for each HTML input element and the values are now being POSTED:

Started POST “/home/tellafriend” for 127.0.0.1 at 2012-02-12 14:23:39
-0400 Processing by HomeController#tellafriend as HTML Parameters: {“utf8″=>”✓”,
“authenticity_token”=>”2N1jNQ30cXCU4YANQ3FEZFBBTNhKobCQUwj1rEZ3Mxw=”,
“name”=>”Sergio”, “emails”=>”stapia.gutierrez@gmai”,
“message”=>”asdf”} Rendered home/tellafriend.html.erb within
layouts/application (0.4ms) Completed 200 OK in 40ms (Views: 26.9ms |
ActiveRecord: 0.0ms)

However the View still doesn’t render the values.

  • 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-05-29T15:13:02+00:00Added an answer on May 29, 2026 at 3:13 pm

    Your input fields are missing a name attribute:

    <input name="name" id="name" class="input-xlarge" type="text"/>
    

    UPDATE TO ANSWER:

    <% %> in erb executes the code within the brackets, but it does not print to template.

    You’ll also need to change in your view:

    <p><% @name %></p> to <p><%= @name %></p>

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

Sidebar

Related Questions

Here is the input form code <tr valign=top> <td align=right class=innertablestyle><font class=normal><strong>Homepage</strong></font></td> <td>&nbsp;</td> <td>
I'm making a form_tag panel that contains information (checkboxes) specific to a controller action.
Environment: Rails 3.0.4 and Ruby 1.9.2 I have the following form: <%= form_tag( {:action
To give more information I am using the modular form here: http://jqueryui.com/demos/dialog/#modal-form `b(e.target).zIndex` is
The current form is here . It is not complete, and only a couple
Here is a simple form I am using to send XML data in admin_xml.php
Here is a code form a PHP+MySQL book I am reading and I am
Here's my code: if Request.Form(authorize) <> and request.form(delete) <> true then post_ids = Request.form(authorize)
Have a simple form (only extract fields here) but for some reason the JQserilization
so here's the problem I have one form, it outputs search results after submit,

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.