Answers.Body: <p>I <em>think</em> the answer is as simple as providing the new Entry's URI to the <code>redirectInput</code> function:</p>
  <pre><code>&lt;form method=&quot;POST&quot;&gt;
    {{ actionInput('entries/save-entry') }}
    {{ redirectInput('{uri}') }}
  
    &lt;input type=&quot;text&quot; name=&quot;title&quot;&gt;
    &lt;button&gt;Save!&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Craft looks at the string you pass in, and evaluates it as an &quot;<a href="https://docs.craftcms.com/api/v3/craft-web-view.html#method-renderobjecttemplate" rel="noreferrer">object template</a>,&quot; wherein you can use the short-hand syntax here (<code>{uri}</code>) to access properties of the saved Entry.</p>
  <blockquote>
  <p>Keep in mind! The behavior here differs based on what Controller you're using—sometimes it'll be a different kind of <code>Element</code>, which may or may not have a useful/predictable <code>uri</code> (i.e. if you're updating an Asset).</p>
  </blockquote>
  <p>The &quot;template&quot; you pass in can be as complex as you want. For example, if the form was part of your dashboard, you might want to prepend with a path of some kind:</p>
  <pre><code>{{ redirectInput('my-account/orders/{id}') }}
  </code></pre>
  <p>Similarly, you can use regular Twig syntax here—Craft just does some of these easy substitutions for you:</p>
  <pre><code>{{ redirectInput('my-account/orders/{{ object.id }}') }}
  </code></pre>
  <blockquote>
  <p>Note that the &quot;template&quot; won't get rendered in the actual request, so you'll see exactly what you typed here (well, plus a hash of the string, so users can't manipulate it)—it's only evaluated when submitted.</p>
  </blockquote>
  <p>For more info, <a href="https://docs.craftcms.com/api/v3/craft-web-controller.html#method-redirecttopostedurl" rel="noreferrer">check out the <code>redirectToPostedUrl($object)</code> method</a>!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-10T18:32:03.483Z
Answers.Text: Lot of great info here. Thanks.
Answers.UserDisplayName: Brimby
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-10T02:00:08.333Z
Answers.LastActivityDate: 2020-07-10T02:00:08.333Z
Answers.UserDisplayName: August Miller
Body: <p>I'm using a frontend form to create an entry with <code>{{ actionInput('entries/save-entry') }}</code> and would like to be able to use this entry immediately upon redirecting from the submit. From the docs I see that the <code>redirectInput()</code> function only accepts a url string. Is it possible to get my hands on the newly created entry's id in order to use it in the redirect?</p>
  <p>For context, I have a page with a user-operated form which, when submitted, creates an entry that represents the customer's order. And upon submission I want to immediately head to a review page where it displays the new order's details back to them. Is there a better way to go about this flow? The only thing I can think to do is use a hidden field to set a unique hash on the slug which I also use in the url put in the redirect.</p>
  
Tags: <saveentry>
Title: How to immediately redirect to an entry after creating the new entry from a frontend form?
ThreadText: # How to immediately redirect to an entry after creating the new entry from a frontend form?
  
  (Asked by: username_0 on 2020-07-09)
  
  I'm using a frontend form to create an entry with `{{ actionInput('entries/save-entry') }}` and would like to be able to use this entry immediately upon redirecting from the submit. From the docs I see that the `redirectInput()` function only accepts a url string. Is it possible to get my hands on the newly created entry's id in order to use it in the redirect?
  
  For context, I have a page with a user-operated form which, when submitted, creates an entry that represents the customer's order. And upon submission I want to immediately head to a review page where it displays the new order's details back to them. Is there a better way to go about this flow? The only thing I can think to do is use a hidden field to set a unique hash on the slug which I also use in the url put in the redirect.
  
  **Tags:** saveentry
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-07-10. Score: 5 | Accepted answer
  
  I *think* the answer is as simple as providing the new Entry's URI to the `redirectInput` function:
  
  ```
  <form method="POST">
    {{ actionInput('entries/save-entry') }}
    {{ redirectInput('{uri}') }}
  
    <input type="text" name="title">
    <button>Save!</button>
  </form>
  
  ```
  
  Craft looks at the string you pass in, and evaluates it as an "[object template](https://docs.craftcms.com/api/v3/craft-web-view.html#method-renderobjecttemplate)," wherein you can use the short-hand syntax here (`{uri}`) to access properties of the saved Entry.
  
  > Keep in mind! The behavior here differs based on what Controller you're using—sometimes it'll be a different kind of `Element`, which may or may not have a useful/predictable `uri` (i.e. if you're updating an Asset).
  
  The "template" you pass in can be as complex as you want. For example, if the form was part of your dashboard, you might want to prepend with a path of some kind:
  
  ```
  {{ redirectInput('my-account/orders/{id}') }}
  
  ```
  
  Similarly, you can use regular Twig syntax here—Craft just does some of these easy substitutions for you:
  
  ```
  {{ redirectInput('my-account/orders/{{ object.id }}') }}
  
  ```
  
  > Note that the "template" won't get rendered in the actual request, so you'll see exactly what you typed here (well, plus a hash of the string, so users can't manipulate it)—it's only evaluated when submitted.
  
  For more info, [check out the `redirectToPostedUrl($object)` method](https://docs.craftcms.com/api/v3/craft-web-controller.html#method-redirecttopostedurl)!
  
  > **Comments:**
  > **username_0**: Lot of great info here. Thanks.  
  
  ---
  
  