Answers.Body: <p>You could use a conditional to check if your "search term" parameter has a value. </p>
  
  <pre><code>&lt;h1&gt;Search Results&lt;/h1&gt;
  
  {% set query = craft.request.getParam('q') %}
  
  {% if query|length  %}
  
      {% set entries = craft.entries.search(query).order('score') %}
  
      {% if entries|length %}
          &lt;p&gt;{{ entries|length }} results:&lt;/p&gt;
  
          &lt;ul&gt;
              {% for entry in entries %}
                  &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
              {% endfor %}
          &lt;/ul&gt;
      {% else %}
          &lt;p&gt;Your search for “{{ query }}” didn’t return any results.&lt;/p&gt;
      {% endif %}
  
  
  {% else %}
      &lt;p&gt;You forgot to enter a search term.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>(This code is modified from the examples in the <a href="http://buildwithcraft.com/docs/templating/search-form" rel="nofollow">Craft docs for "Search Form"</a>)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-22T16:48:44.130Z
Answers.LastActivityDate: 2015-04-22T17:01:27.080Z
Answers.LastEditDate: 2015-04-22T17:01:27.080Z
Answers.UserDisplayName: Dylan T
Body: <p>When you click in search form and press 'Enter' or 'Submit' button, it returns all entries, that exist in database.</p>
  
  <p>How could I display some message rather than all entries?</p>
  
Tags: <search>
Title: Search result on blank search query
ThreadText: # Search result on blank search query
  
  (Asked by: username_0 on 2015-04-22)
  
  When you click in search form and press 'Enter' or 'Submit' button, it returns all entries, that exist in database.
  
  How could I display some message rather than all entries?
  
  **Tags:** search
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-22. Score: 2 | Accepted answer
  
  You could use a conditional to check if your "search term" parameter has a value.
  
  ```
  <h1>Search Results</h1>
  
  {% set query = craft.request.getParam('q') %}
  
  {% if query|length  %}
  
      {% set entries = craft.entries.search(query).order('score') %}
  
      {% if entries|length %}
          <p>{{ entries|length }} results:</p>
  
          <ul>
              {% for entry in entries %}
                  <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
              {% endfor %}
          </ul>
      {% else %}
          <p>Your search for “{{ query }}” didn’t return any results.</p>
      {% endif %}
  
  {% else %}
      <p>You forgot to enter a search term.</p>
  {% endif %}
  
  ```
  
  (This code is modified from the examples in the [Craft docs for "Search Form"](http://buildwithcraft.com/docs/templating/search-form))
  
  
  ---
  
  