Answers.Body: <p>First thing I recommend is to read through the <a href="http://buildwithcraft.com/docs/templating/search-form" rel="nofollow">Search Form</a> guide from the Craft documentation.
  To explain the rest I'll add some comments to the example code.</p>
  
  <p><em>form.html</em></p>
  
  <pre><code>{# Use the `group` filter to get the years, entries were posted in #}
  {% set entries = craft.entries.section('news') %}
  {% set entriesByYear = entries|group('postDate|date("Y")') %}
  
  &lt;select name="year"&gt;
  
      {# Go through the `year` groups #}
      {% for year, entries in entriesByYear %}
          &lt;option value="{{ year }}"&gt;{{ year }}&lt;/option&gt;
      {% endfor %}
  
  &lt;/select&gt;
  </code></pre>
  
  <p><em>results.html</em></p>
  
  <pre><code>{# Get the params #}
  {% set year = craft.request.getParam('year') %}
  
  {# Compose a param in this format: 'and, &gt;= 2014-01-01, &lt; 2015-01-01' #}
  {% set dateParam = 'and, &gt;= ' ~ year ~ '-01-01, &lt; ' ~ (year + 1) ~ '-01-01' %}
  
  {# Query and loop through the entries #}
  {% set entries = craft.entries.section('news').postDate(dateParam) %}
  
  {% if entries|length %}
      ...
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T10:15:11.610Z
Answers.Text: Ok, How does this make Ajax, as in the admin panel)
Answers.UserDisplayName: Vitaliy  Badalov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T10:24:55.073Z
Answers.Text: First make everything work as you expect it to and then implement the JS. How to do that exactly would be another question, but basically you need to prevent the full page reload (`event.preventDefault()` method) and then load in the newly filtered content. There's other great answers on Ajax topics here on Craft SE (→ i.e. [these ones](http://craftcms.stackexchange.com/q/4809/125) here).
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T11:25:46.803Z
Answers.Text: As instead of `'postDate | date ("Y")'` substitute custom fields?
Answers.UserDisplayName: Vitaliy  Badalov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T12:18:57.440Z
Answers.Text: This should actually work the same for any custom Date/Time fields, just replace the field handle like so `'myCustomDateField|date("Y")'`.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T09:02:36.230Z
Answers.LastActivityDate: 2015-03-03T09:02:36.230Z
Answers.UserDisplayName: carlcs
Body: <p>For example have the following code:</p>
  
  <pre><code>&lt;form action=""&gt;
         &lt;select&gt;
                 &lt;option&gt;2015&lt;/option&gt;
                 &lt;option&gt;2014&lt;/option&gt;
                 &lt;option&gt;2013&lt;/option&gt;
                 &lt;option&gt;2012&lt;/option&gt;
        &lt;/select&gt;
  
        &lt;input type="submit" value="select"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>how to get a entries of the selected year?</p>
  
Tags: <templating><entries><form><datetime>
Title: Form select entries by year
ThreadText: # Form select entries by year
  
  (Asked by: username_0 on 2015-03-03)
  
  For example have the following code:
  
  ```
  <form action="">
         <select>
                 <option>2015</option>
                 <option>2014</option>
                 <option>2013</option>
                 <option>2012</option>
        </select>
  
        <input type="submit" value="select">
  </form>
  
  ```
  
  how to get a entries of the selected year?
  
  **Tags:** templating, entries, form, datetime
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-03-03. Score: 2
  
  First thing I recommend is to read through the [Search Form](http://buildwithcraft.com/docs/templating/search-form) guide from the Craft documentation.
  To explain the rest I'll add some comments to the example code.
  
  *form.html*
  
  ```
  {# Use the `group` filter to get the years, entries were posted in #}
  {% set entries = craft.entries.section('news') %}
  {% set entriesByYear = entries|group('postDate|date("Y")') %}
  
  <select name="year">
  
      {# Go through the `year` groups #}
      {% for year, entries in entriesByYear %}
          <option value="{{ year }}">{{ year }}</option>
      {% endfor %}
  
  </select>
  
  ```
  
  *results.html*
  
  ```
  {# Get the params #}
  {% set year = craft.request.getParam('year') %}
  
  {# Compose a param in this format: 'and, >= 2014-01-01, < 2015-01-01' #}
  {% set dateParam = 'and, >= ' ~ year ~ '-01-01, < ' ~ (year + 1) ~ '-01-01' %}
  
  {# Query and loop through the entries #}
  {% set entries = craft.entries.section('news').postDate(dateParam) %}
  
  {% if entries|length %}
      ...
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Ok, How does this make Ajax, as in the admin panel)  
  > **username_1**: First make everything work as you expect it to and then implement the JS. How to do that exactly would be another question, but basically you need to prevent the full page reload (`event.preventDefault()` method) and then load in the newly filtered content. There's other great answers on Ajax topics here on Craft SE (→ i.e. [these ones](http://craftcms.stackexchange.com/q/4809/125) here).  
  > **username_0**: As instead of `'postDate | date ("Y")'` substitute custom fields?  
  > **username_1**: This should actually work the same for any custom Date/Time fields, just replace the field handle like so `'myCustomDateField|date("Y")'`.  
  
  ---
  
  