Error submitting form

Hi

I just started learning ruby on rails.
Now i've made a simple form with a textfield and a submit button.

This solution is fine for one time but i don't like every time i
have a
form to add this line!
So my question is, isn't there a final solution for this problem so i
don't need to add this line every time i'm using a form?

Use the rails form helpers (form_for, form_tag etc...)

Fred

yes, use the form_helpers, instead of pure html forms

<% form_tag :controller => "some_controller", :action => "some_action"
%>
<%= text_field "txtName" %>
<%= submit "submit" %>
<% end %>

and so on. there are many methods in Rails to create
forms and other html.
If you start using Models, you'll most likely use form_for
instead of the more simple form_tag.

You should start reading some tutorials on Rails and the API docs
or you will miss it's main points and don't get the benefits.

http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M001699

Ok thx, i'll check the form helpers and do some tutorials :slight_smile:
Thx for the help

<% form_tag :controller => "some_controller", :action => "some_action"
%>
<%= text_field "txtName" %>
<%= submit "submit" %>
<% end %>

Ruby on rails use <%= to write something on the page ...
But isn't there no other function who does that?

thx

form_tag and some others are a bit special and use. Not sure what you mean by "But isn't there no other function who does that?"

The above should be <% form_tag :controller => "some_controller", :action => "some_action" do %>
Fred