Answers.Body: <p>If you use the <a href="https://github.com/pixelandtonic/GuestEntries" rel="nofollow">Guest Entries</a> plugin to submit the entry, then the variable that the invalid entry is called is actually configurable, using the <a href="https://github.com/pixelandtonic/GuestEntries#configuration" rel="nofollow">entryVariable</a> config setting.</p>
  
  <p>So just create a new file in craft/config/ called guestentries.php, with this:</p>
  
  <pre><code>&lt;?php
  
  return array(
      'entryVariable' =&gt; 'invalidEntry'
  );
  </code></pre>
  
  <p>Then from your template you can just check to see if <code>invalidEntry</code> is defined.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-02T18:36:42.807Z
Answers.Text: Hi brandon, what if not using guest entry but normal form? How do i change the variable like the same as guest entry? Cause my single page using "entry" and form too using "entry" as well.
Answers.UserDisplayName: Hs Tung
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-02T23:06:50.527Z
Answers.Text: @HsTung Currently it’s not possible with the normal entries/saveEntry action.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-02T16:38:01.277Z
Answers.LastActivityDate: 2014-11-02T16:38:01.277Z
Answers.UserDisplayName: Brandon Kelly
Answers.Body: <p>It sounds like you've got your home page setup as a Single. Which is a great way to go, and that's what is <strong>automatically setting the <code>entry</code> variable</strong>.</p>
  
  <p>Here's a great walkthrough on creating an "edit entry" form...</p>
  
  <blockquote>
    <p><a href="http://buildwithcraft.com/docs/templating/entry-form" rel="nofollow">http://buildwithcraft.com/docs/templating/entry-form</a></p>
  </blockquote>
  
  <p>Keep in mind, that example uses <code>entry</code> to represent the entry being edited. That won't work for you, however, since <code>entry</code> is being automatically set as your home page Single.</p>
  
  <p>So when you're attempting to modify another entry, I'd recommend setting it to a <em>different</em> variable name. Obviously you can't have your home page and other entry both be represented by a variable named <code>entry</code>.</p>
  
  <pre><code>{% set entryToEdit = craft.entries.slug('my-entry-to-edit').first %}
  </code></pre>
  
  <p>Then <code>entryToEdit</code> would replace any instances of <code>entry</code> in the <a href="http://buildwithcraft.com/docs/templating/entry-form" rel="nofollow">documented example</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-01T15:54:55.217Z
Answers.Text: Thanks for your answer but what if that is new entry form but not edit form?
  I want to retain the value when there is error occur after form post. the form exactly like mention in doc
  `http://buildwithcraft.com/docs/templating/entry-form`
  How should I replace the entry variable in the form with something else since you mention single had use my entry variable.
Answers.UserDisplayName: Hs Tung
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-01T18:26:52.100Z
Answers.Text: That's an interesting question... Typically, when you submit to `entries/saveEntry` (as this form is doing) it will reload the page with any error messages attached to the `entry` object. Those would be accessed via `entry.getErrors()`. But... what would it return in this case? Would there be a collision when the page is reloaded? I suspect there would be... You may want to email support@buildwithcraft.com to get more clarification.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-01T15:27:57.263Z
Answers.LastActivityDate: 2014-11-01T15:27:57.263Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p>I got this plugin from Brandon.
  <a href="https://github.com/pixelandtonic/GuestEntries" rel="nofollow">https://github.com/pixelandtonic/GuestEntries</a></p>
  
  <p>And it solve the problem I face.
  Now I able allow guest to submit entry and it able to change the variable not to use entry but any variable you name in config.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-02T16:33:39.640Z
Answers.LastActivityDate: 2014-11-02T16:33:39.640Z
Answers.UserDisplayName: Hs Tung
Body: <p>I have an entry form in home page which the home page already using the entry object.</p>
  
  <p>And I am placing the entry form in home page when i call</p>
  
  <blockquote>
    <p>{%- if entry is defined %} value="{{ entry.title }}"{% endif -%}</p>
  </blockquote>
  
  <p>and this will grab the home page title, and this is not the result i want.
  I need when the form submit and error return with value.</p>
  
  <p>By the way, any source to learn about entry form? I don't see much tutorial about entry form. Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-03T20:14:33.663Z
Comments.Text: What does the hyphen mean in the tag? This part: "{%-". As in, what's the difference between {% if %} and {%- if %}
Comments.UserDisplayName: Nathan D Huening
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-04T09:19:19.447Z
Comments.Text: @NathanDHuening Using hyphens in your Twig tags allows you to remove whitespace. Have a look here: http://twig.sensiolabs.org/doc/templates.html#whitespace-control
Comments.UserDisplayName: Jamie Wade
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-04T10:03:06.420Z
Comments.Text: @JamieWade Ah.. Thanks for the explaination. Me myself also forgot this. haha
Comments.UserDisplayName: Hs Tung
Tags: <form>
Title: Entry form in home page
ThreadText: # Entry form in home page
  
  (Asked by: username_0 on 2014-11-01)
  
  I have an entry form in home page which the home page already using the entry object.
  
  And I am placing the entry form in home page when i call
  
  > {%- if entry is defined %} value="{{ entry.title }}"{% endif -%}
  
  and this will grab the home page title, and this is not the result i want.
  I need when the form submit and error return with value.
  
  By the way, any source to learn about entry form? I don't see much tutorial about entry form. Thanks.
  
  **Tags:** form
  
  > **Comments:**
  > **username_1**: What does the hyphen mean in the tag? This part: "{%-". As in, what's the difference between {% if %} and {%- if %}  
  > **username_2**: @username_1 Using hyphens in your Twig tags allows you to remove whitespace. Have a look here: http://twig.sensiolabs.org/doc/templates.html#whitespace-control  
  > **username_0**: @username_2 Ah.. Thanks for the explaination. Me myself also forgot this. haha  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2014-11-02. Score: 3 | Accepted answer
  
  If you use the [Guest Entries](https://github.com/pixelandtonic/GuestEntries) plugin to submit the entry, then the variable that the invalid entry is called is actually configurable, using the [entryVariable](https://github.com/pixelandtonic/GuestEntries#configuration) config setting.
  
  So just create a new file in craft/config/ called guestentries.php, with this:
  
  ```
  <?php
  
  return array(
      'entryVariable' => 'invalidEntry'
  );
  
  ```
  
  Then from your template you can just check to see if `invalidEntry` is defined.
  
  > **Comments:**
  > **username_0**: Hi username_3, what if not using guest entry but normal form? How do i change the variable like the same as guest entry? Cause my single page using "entry" and form too using "entry" as well.  
  > **username_3**: @username_0 Currently it’s not possible with the normal entries/saveEntry action.  
  
  ---
  
  ### Answer by username_4 on 2014-11-01. Score: 3
  
  It sounds like you've got your home page setup as a Single. Which is a great way to go, and that's what is **automatically setting the `entry` variable**.
  
  Here's a great walkthrough on creating an "edit entry" form...
  
  > <http://buildwithcraft.com/docs/templating/entry-form>
  
  Keep in mind, that example uses `entry` to represent the entry being edited. That won't work for you, however, since `entry` is being automatically set as your home page Single.
  
  So when you're attempting to modify another entry, I'd recommend setting it to a *different* variable name. Obviously you can't have your home page and other entry both be represented by a variable named `entry`.
  
  ```
  {% set entryToEdit = craft.entries.slug('my-entry-to-edit').first %}
  
  ```
  
  Then `entryToEdit` would replace any instances of `entry` in the [documented example](http://buildwithcraft.com/docs/templating/entry-form).
  
  > **Comments:**
  > **username_0**: Thanks for your answer but what if that is new entry form but not edit form? I want to retain the value when there is error occur after form post. the form exactly like mention in doc `http://buildwithcraft.com/docs/templating/entry-form` How should I replace the entry variable in the form with something else since you mention single had use my entry variable.  
  > **username_4**: That's an interesting question... Typically, when you submit to `entries/saveEntry` (as this form is doing) it will reload the page with any error messages attached to the `entry` object. Those would be accessed via `entry.getErrors()`. But... what would it return in this case? Would there be a collision when the page is reloaded? I suspect there would be... You may want to email support@buildwithcraft.com to get more clarification.  
  
  ---
  
  ### Answer by username_0 on 2014-11-02. Score: 1
  
  I got this plugin from username_3.
  <https://github.com/pixelandtonic/GuestEntries>
  
  And it solve the problem I face.
  Now I able allow guest to submit entry and it able to change the variable not to use entry but any variable you name in config.
  
  
  ---
  
  