Answers.Body: <p>I think the way you are trying to add entries requires authentication, if you look on the <a href="http://buildwithcraft.com/docs/templating/entry-form" rel="nofollow">entry form page</a> in the craft docs, you will see this snippet of text:</p>
  
  <blockquote>
    <p>The user submitting the entry will also need to have the permission necessary to create entries for the section they are posting to</p>
  </blockquote>
  
  <p>So I think you would need to use the guest entries plugin (from P&amp;T), unless i'm mistaken, so maybe give that a try and see if it fixes the issue?</p>
  
  <p><a href="https://github.com/pixelandtonic/GuestEntries" rel="nofollow">Guest Entries plugin on Github</a></p>
  
  <p>The difference in markup is here:</p>
  
  <pre><code>&lt;input type="hidden" name="action" value="guestEntries/saveEntry"&gt;
  </code></pre>
  
  <p>This is the way I have done this on a site i've built and not had any issues, entries get saved and to the specified type. :)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T17:49:08.783Z
Answers.Text: Thanks Alec - I've installed GuestEntries (updated question) but it's not solved the problem. When I submit the form, I get taken to the Template Error page in the question (http://i.imgur.com/aYj2a3d.png). It's something to do with the way I'm redirecting structure templates...
Answers.UserDisplayName: darylknight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T17:57:00.687Z
Answers.Text: Alec - I'm guess the sites you've done in the past have used a different template routing structure. The error here isn't being caused by permissions, it's because the form is looking for a template that doesn't exist. No idea why it's looking for a template in the first place!
Answers.UserDisplayName: darylknight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T18:03:46.110Z
Answers.Text: Added a new answer as it's completely unrelated to the guest entries answer :)
Answers.UserDisplayName: Alec Ritson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-22T15:38:35.990Z
Answers.LastActivityDate: 2014-10-22T15:38:35.990Z
Answers.UserDisplayName: Alec Ritson
Answers.Body: <p>Based on the comments from my other answer and seeing the image you sent.</p>
  
  <p>Look in the template <code>hire-us/index.html</code> where you are trying to include a template dynamically with the <code>entry.type</code> variable, what that is generating does not correspond to a template you have, so it can't find the template to include and therefore you are getting the error.
  As the error States craft is unable to find the template</p>
  
  <p>Try removing the include altogether and just put <code>{{ entry.type }}</code> in the template and go through the process again so you can see what's being generated and get the name of the template you need to create to satisfy the include.</p>
  
  <p>Hope that helps </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T18:26:48.233Z
Answers.Text: Hi Alec, thank you for all your help, but it turns out it was simpler than expected. Answered my own question, it was because the Title field was missing ><
Answers.UserDisplayName: darylknight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T19:00:11.787Z
Answers.Text: Ahh no worries, glad you got things sorted in the end! :)
Answers.UserDisplayName: Alec Ritson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T18:03:14.497Z
Answers.LastActivityDate: 2014-10-28T18:03:14.497Z
Answers.UserDisplayName: Alec Ritson
Answers.Body: <p>This has been solved via a support ticket, which I'm posting here for others etc.</p>
  
  <blockquote>
    <p>The first time you load the template, the URI is mapping to your "Get
    A Quote" entry, which gets assigned to the entry variable when your
    template is loaded.</p>
    
    <p>When you submit the form, the same URL is requested again, once again
    matching your "Get A Quote" entry, but this time the
    guestEntries/saveEntry controller action is summoned. When there's a
    validation error, Guest Entries will pass the new entry back to the
    template as an entry variable, overriding the "Get A Quote" entry that
    the URL matched. So, then the template gets routed to
    hire-us/index.html like it normally did, but this time entry.type is
    enquiryWeddingDance instead of getAQuote, since it's a different entry
    altogether. The template tries to include
    hire-us/enquiryWeddingDance.html, but that doesn't exist, so you get
    the error.</p>
    
    <p>To fix this, I've just released an update to the Guest Entries plugin,
    which adds a new <a href="https://github.com/pixelandtonic/GuestEntries#configuration" rel="nofollow">entryVariable config setting</a>. You can use that to
    customize the variable name that Guest Entries will set the invalid
    entry to (i.e. 'guestEntry' or 'invalidEntry'), so it doesn't conflict
    with the entry variable that the request is getting routed to.</p>
  </blockquote>
  
  <p>After setting the Guest Entries variable as suggested in the <a href="https://github.com/pixelandtonic/GuestEntries#configuration" rel="nofollow">documentation</a>, it's now working as expected without conflicts. Thanks Brandon!</p>
  
  <p>Usage:</p>
  
  <pre><code>{% if guestEntry is defined %}{{ errorList(guestEntry.getErrors('variableName')) }}{% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T18:25:27.917Z
Answers.LastActivityDate: 2014-10-30T16:31:07.620Z
Answers.LastEditDate: 2014-10-30T16:31:07.620Z
Answers.UserDisplayName: darylknight
Body: <p>I have a few different forms on my site for different kinds of enquiries, each represented by an <code>Entry Type</code> with different fields in a single <code>Enquiries</code> channel. How can I get the entries/saveEntry form to save as a specific entry type?</p>
  
  <p>My existing form:</p>
  
  <pre><code>&lt;input type="hidden" name="action" value="guestEntries/saveEntry"&gt;
  &lt;input type="hidden" name="redirect" value="/hire-us/get-a-quote/success"&gt;
  &lt;input type="hidden" name="sectionId" value="61"&gt;
  </code></pre>
  
  <p>I have two entry types in that channel, ID 111 and 112. When I add the line:</p>
  
  <pre><code>&lt;input type="hidden" name="typeId" value="111"&gt;
  </code></pre>
  
  <p>then submit the form, I get an error message saying "<em>Unable to find the template 'hire-us/enquiryPlanningEvent'</em>". It appears that Craft is looking for a template named after the entry type I'm trying to save, but obviously there isn't one.
  What's the solution to this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-22T18:26:47.183Z
Comments.Text: If you enable [Dev Mode](http://buildwithcraft.com/help/dev-mode) Craft will give you a full stack trace when that error occurs. That may give you more insight into why it’s happening.
Comments.UserDisplayName: Brandon Kelly
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-28T17:46:11.053Z
Comments.Text: No stack trace I'm afraid Brandon - I'm seeing this error: http://i.imgur.com/aYj2a3d.png
Comments.UserDisplayName: darylknight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-28T21:45:24.027Z
Comments.Text: Do you have any idea how that template is getting invoked? Maybe via the `redirect` param?
Comments.UserDisplayName: Brandon Kelly
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-30T10:40:29.327Z
Comments.Text: I did solve this - but I don't know why the error I got was happening. Basically if the `Title` field is expecting a value (i.e. not set automatically), and I submit the form without setting a title, then it redirects me to a template with the same handle as the Entry Type I was trying to submit to (regardless of the `redirect` value). Bug?
Comments.UserDisplayName: darylknight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-30T10:53:54.110Z
Comments.Text: Actually it's not just if the Title field is missing, it happens if any required field has no data. Filing a bug report. Expected behaviour is that it should reload the page and call the errorList.
Comments.UserDisplayName: darylknight
Tags: <entries><form><entry-type><guest-entries>
Title: How do I save a front-end form as a specific Entry Type?
ThreadText: # How do I save a front-end form as a specific Entry Type?
  
  (Asked by: username_0 on 2014-10-22)
  
  I have a few different forms on my site for different kinds of enquiries, each represented by an `Entry Type` with different fields in a single `Enquiries` channel. How can I get the entries/saveEntry form to save as a specific entry type?
  
  My existing form:
  
  ```
  <input type="hidden" name="action" value="guestEntries/saveEntry">
  <input type="hidden" name="redirect" value="/hire-us/get-a-quote/success">
  <input type="hidden" name="sectionId" value="61">
  
  ```
  
  I have two entry types in that channel, ID 111 and 112. When I add the line:
  
  ```
  <input type="hidden" name="typeId" value="111">
  
  ```
  
  then submit the form, I get an error message saying "*Unable to find the template 'hire-us/enquiryPlanningEvent'*". It appears that Craft is looking for a template named after the entry type I'm trying to save, but obviously there isn't one.
  What's the solution to this?
  
  **Tags:** entries, form, entry-type, guest-entries
  
  > **Comments:**
  > **username_1**: If you enable [Dev Mode](http://buildwithcraft.com/help/dev-mode) Craft will give you a full stack trace when that error occurs. That may give you more insight into why it’s happening.  
  > **username_0**: No stack trace I'm afraid username_1 - I'm seeing this error: http://i.imgur.com/aYj2a3d.png  
  > **username_1**: Do you have any idea how that template is getting invoked? Maybe via the `redirect` param?  
  > **username_0**: I did solve this - but I don't know why the error I got was happening. Basically if the `Title` field is expecting a value (i.e. not set automatically), and I submit the form without setting a title, then it redirects me to a template with the same handle as the Entry Type I was trying to submit to (regardless of the `redirect` value). Bug?  
  > **username_0**: Actually it's not just if the Title field is missing, it happens if any required field has no data. Filing a bug report. Expected behaviour is that it should reload the page and call the errorList.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2014-10-28. Score: 4 | Accepted answer
  
  This has been solved via a support ticket, which I'm posting here for others etc.
  
  > The first time you load the template, the URI is mapping to your "Get
  > A Quote" entry, which gets assigned to the entry variable when your
  > template is loaded.
  >
  > When you submit the form, the same URL is requested again, once again
  > matching your "Get A Quote" entry, but this time the
  > guestEntries/saveEntry controller action is summoned. When there's a
  > validation error, Guest Entries will pass the new entry back to the
  > template as an entry variable, overriding the "Get A Quote" entry that
  > the URL matched. So, then the template gets routed to
  > hire-us/index.html like it normally did, but this time entry.type is
  > enquiryWeddingDance instead of getAQuote, since it's a different entry
  > altogether. The template tries to include
  > hire-us/enquiryWeddingDance.html, but that doesn't exist, so you get
  > the error.
  >
  > To fix this, I've just released an update to the Guest Entries plugin,
  > which adds a new [entryVariable config setting](https://github.com/pixelandtonic/GuestEntries#configuration). You can use that to
  > customize the variable name that Guest Entries will set the invalid
  > entry to (i.e. 'guestEntry' or 'invalidEntry'), so it doesn't conflict
  > with the entry variable that the request is getting routed to.
  
  After setting the Guest Entries variable as suggested in the [documentation](https://github.com/pixelandtonic/GuestEntries#configuration), it's now working as expected without conflicts. Thanks username_1!
  
  Usage:
  
  ```
  {% if guestEntry is defined %}{{ errorList(guestEntry.getErrors('variableName')) }}{% endif %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2014-10-22. Score: 1
  
  I think the way you are trying to add entries requires authentication, if you look on the [entry form page](http://buildwithcraft.com/docs/templating/entry-form) in the craft docs, you will see this snippet of text:
  
  > The user submitting the entry will also need to have the permission necessary to create entries for the section they are posting to
  
  So I think you would need to use the guest entries plugin (from P&T), unless i'm mistaken, so maybe give that a try and see if it fixes the issue?
  
  [Guest Entries plugin on Github](https://github.com/pixelandtonic/GuestEntries)
  
  The difference in markup is here:
  
  ```
  <input type="hidden" name="action" value="guestEntries/saveEntry">
  
  ```
  
  This is the way I have done this on a site i've built and not had any issues, entries get saved and to the specified type. :)
  
  > **Comments:**
  > **username_0**: Thanks username_2 - I've installed GuestEntries (updated question) but it's not solved the problem. When I submit the form, I get taken to the Template Error page in the question (http://i.imgur.com/aYj2a3d.png). It's something to do with the way I'm redirecting structure templates...  
  > **username_0**: username_2 - I'm guess the sites you've done in the past have used a different template routing structure. The error here isn't being caused by permissions, it's because the form is looking for a template that doesn't exist. No idea why it's looking for a template in the first place!  
  > **username_2**: Added a new answer as it's completely unrelated to the guest entries answer :)  
  
  ---
  
  ### Answer by username_2 on 2014-10-28. Score: 1
  
  Based on the comments from my other answer and seeing the image you sent.
  
  Look in the template `hire-us/index.html` where you are trying to include a template dynamically with the `entry.type` variable, what that is generating does not correspond to a template you have, so it can't find the template to include and therefore you are getting the error.
  As the error States craft is unable to find the template
  
  Try removing the include altogether and just put `{{ entry.type }}` in the template and go through the process again so you can see what's being generated and get the name of the template you need to create to satisfy the include.
  
  Hope that helps
  
  > **Comments:**
  > **username_0**: Hi username_2, thank you for all your help, but it turns out it was simpler than expected. Answered my own question, it was because the Title field was missing ><  
  > **username_2**: Ahh no worries, glad you got things sorted in the end! :)  
  
  ---
  
  