Differnece between form_for and form_remote_tag

Hi

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

Thanks in advance
Sijo

form_remote_tag is used for creating a form which will be submitted via
Ajax.
Adam

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.

Hi

thanks for all the replies

Sijo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs