E
E
Evgeny Troinov2017-03-22 08:59:59
Erlang
Evgeny Troinov, 2017-03-22 08:59:59

Transition through pages through the form, why?

Good afternoon,
I saw the following helpers in phoenixframework:

button("hello", to: "/world")
#=> <form action="/world" class="button" method="post">
      <input name="_csrf_token" value="">
      <button type="submit">hello</button>
    </form>

button("hello", to: "/world", method: "get", class: "btn")
#=> <form action="/world" class="btn" method="get">
      <button type="submit">hello</button>
    </form>

What is the practical use of organizing a page transition through a form, why is it better than a regular link?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IvanN777, 2017-03-22
@tot0ro

Form as a transition is stupid.
Here it is necessary to rely on the general practice of the web.
Forms are search(get) and modification(post(PATCH/PUT DELETE))
https://hexdocs.pm/phoenix_html/Phoenix.HTML.Link.html
Useful to make sure the link will not be called by search engines for indexing.
My opinion
Well, with the same success, you can insert js (non-standard logic)
Looks like a perversion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question