Skip to content

Commit

Permalink
Merge pull request cakephp#6038 from kgbph/patch-2
Browse files Browse the repository at this point in the history
Update 'Setting a URL for the Form' section
  • Loading branch information
markstory authored Apr 24, 2019
2 parents 489dc08 + 253948e commit 6aafc8f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions en/views/helpers/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,26 @@ Using the ``'url'`` option allows you to point the form to a specific action in
your current controller or another controller in your application.

For example,
if you'd like to point the form to the ``login()`` action of the current
if you'd like to point the form to the ``publish()`` action of the current
controller, you would supply an ``$options`` array, like the following::

echo $this->Form->create($article, ['url' => ['action' => 'login']]);
echo $this->Form->create($article, ['url' => ['action' => 'publish']]);

Output:

.. code-block:: html

<form method="post" action="/users/login">
<form method="post" action="/articles/publish">

If the desired form action isn't in the current controller, you can specify
a complete URL for the form action. The supplied URL can be relative to your
CakePHP application::

echo $this->Form->create(null, [
'url' => ['controller' => 'Articles', 'action' => 'publish']
'url' => [
'controller' => 'Articles',
'action' => 'publish'
]
]);

Output:
Expand Down

0 comments on commit 6aafc8f

Please sign in to comment.