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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:13:58+00:00 2026-06-14T21:13:58+00:00

I have an HTML form in Rails: <form id=my_form action=submit> Title: <input type=text name=title>

  • 0

I have an HTML form in Rails:

<form id="my_form" action="submit">
  Title: <input type="text" name="title"> 
</form> 

I want to add a new field using a <textarea>:

Comment: <textarea rows="4" cols="50"></textarea>

Is it okay if put this into the form? How can I access the value that the user fills in?

  • 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-14T21:13:59+00:00Added an answer on June 14, 2026 at 9:13 pm

    Unless you have some good reason not to, you should really use the action view helpers provided by rails.

    The form helpers provide resource-oriented methods which create a form and a scope around a specific model object, but this does not suit your case.

    What you want instead is to use to use the generic form tag helpers, which include generic versions of the form methods not tied to any specific model or record, e.g.: form_tag, text_field_tag, text_area_tag, etc. These methods do not require you to pass a record to them or define them in terms of a specific model; you can define arbitrary actions, ids etc., like so:

    <%= form_tag "submit", :id => "my_form" do -%>
      Title: <%= text_field_tag "title" %>
      Comment: <%= text_area_tag "comment", :rows => 4, :cols => 50 %>
      <%= submit_tag "Submit" %>
    <% end -%>
    

    Note that you had no name or id on your textarea, so I’ve arbitrarily assigned them the string "comment", which makes sense for the case.

    In terms of accessing the value(s) the user enters, you just do it like any other form, i.e. in your controller you just access params[:title], params[:comment] etc.

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

Sidebar

Related Questions

I have a html form <form action=process.php method=post> <input type=checkbox name=name[v1] /> <input type=checkbox
Le HTML: <form action=/comment_replies/ajax_create/30?type=2 id=new_comment_2_30 method=post onsubmit=new Ajax.Request('/comment_replies/ajax_create/30?type=2', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;> <textarea
i have html form i am using <a href="#" onclick="document.aa.submit()"> instead of submit button
My input tag started to go crazy... I have html form for input to
I have an html form and I need to populate one of the input
I have a HTML form; I want to be able to set it so
In my Rails 3.2 project, I have a form to create a new site
In my Rails 3.2 project, I have a form to create a new post
I have a form in Rails 3.0.3 that uses the new :remote=>true feature: <%=
In Rails 3.0 I have the standard 'new' form that creates a new record,

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.