differnece between form_for and form_remote_tag

31 views
Skip to first unread message

Sijo Kg

unread,
Mar 17, 2008, 2:19:16 AM3/17/08
to rubyonra...@googlegroups.com
Hi

Could you please explain the difference between form_for and
form_remote_tag..On which circumstances they are used?

Thanks in advance
Sijo
--
Posted via http://www.ruby-forum.com/.

Adam Cohen

unread,
Mar 17, 2008, 2:26:23 AM3/17/08
to rubyonra...@googlegroups.com
form_remote_tag is used for creating a form which will be submitted via Ajax.

Adam

Nathan Esquenazi

unread,
Mar 17, 2008, 3:08:02 AM3/17/08
to rubyonra...@googlegroups.com
There is actually four types of form commands, in two categories:

Model-Backed Forms (forms based on a activerecord object)


Regular Forms (forms not based on a particular object)


and then there are the Ajax and POST variety of each.

So we have:

1) remote_form_for (ajax, model-backed) which is used to perform ajax
actions on a form which is composed of fields relating to a specific
active record object.

2) form_for (standard POST, model-backed) which is for performing a
standard http post on a form which is composed of fields relating to a
specific active record object.

3) form_tag (standard POST, not model-backed) which is for performing a
standard http post on a form which is not model backed and has arbitrary
input fields.

4) form_remote_tag (ajax post, not model-backed) which is for performing
a ajax post on a form which is not model backed and has arbitrary input
fields.

Sijo Kg

unread,
Mar 17, 2008, 3:43:33 AM3/17/08
to rubyonra...@googlegroups.com
Hi

thanks for all the replies

Sijo

Reply all
Reply to author
Forward
0 new messages