Answers.Body: <p>The syntax to set a custom field parameter on a Matrix Block element criteria model is like so:</p>
  
  <pre><code>{% set blocks = entry.myMatrixField.mySmartMapField(params) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-16T09:35:34.163Z
Answers.LastActivityDate: 2015-10-16T09:35:34.163Z
Answers.UserDisplayName: carlcs
Body: <p>I'm trying to search through a set of results inside a Matrix field. Craft is giving me this error message: <code>Craft\EntryModel and its behaviors do not have a method or closure named "avdelinger"</code>.</p>
  
  <p>When I searched the information without the Matrix field it worked but now it's not. I'm using the smart map plugin to find the nearest office added in my Matrix field. Here's my code: </p>
  
  <pre><code>{% block content %}
  
  &lt;form action=""&gt;
      &lt;input type="search" name="sted" placeholder="Search"&gt;
      &lt;input type="submit" value="Go"&gt;
  &lt;/form&gt;
  
  {% for block in entry.avdelinger %}
      &lt;div&gt;
          &lt;h3&gt;{{ block.navn }}&lt;/h3&gt;
          {{ block.sted.street1 }}&lt;br /&gt;
          {{ block.sted.city }}, {{ block.sted.zip }}
      &lt;/div&gt;
      &lt;div&gt;
          Latitude: {{ block.sted.lat }}&lt;br /&gt;
          Longitude: {{ block.sted.lng }}
      &lt;/div&gt;
  {% endfor %}
  
  
  &lt;!-- results --&gt;
  {% set target = craft.request.getParam('sted') %}
  {% set params = {
      target: target,
      range: 1000,
      units: "kilometers"
  } %}
  
  {% set blocks = entry.avdelinger(params).order('distance').find() %}
  
  &lt;h2&gt;Showing results for "{{ target }}"&lt;/h2&gt;
  {% for block in blocks %}
      &lt;div&gt;
          {{ block.sted.street1 }}&lt;br /&gt;
          {{ block.sted.city }}, {{ block.sted.zip }}&lt;br&gt;
          &lt;strong&gt;{{ block.sted.distance | number_format(2) }} kilometers away&lt;/strong&gt;
      &lt;/div&gt;
  {% else %}
      &lt;h2&gt;No results found&lt;/h2&gt;
  {% endfor %}
  
  {% endblock %}
  </code></pre>
  
  <p>Thanks!</p>
  
Tags: <matrix><elementcriteriamodel><plugin-smartmap>
Title: Search Matrix and Smartmap
ThreadText: # Search Matrix and Smartmap
  
  (Asked by: username_0 on 2015-10-16)
  
  I'm trying to search through a set of results inside a Matrix field. Craft is giving me this error message: `Craft\EntryModel and its behaviors do not have a method or closure named "avdelinger"`.
  
  When I searched the information without the Matrix field it worked but now it's not. I'm using the smart map plugin to find the nearest office added in my Matrix field. Here's my code:
  
  ```
  {% block content %}
  
  <form action="">
      <input type="search" name="sted" placeholder="Search">
      <input type="submit" value="Go">
  </form>
  
  {% for block in entry.avdelinger %}
      <div>
          <h3>{{ block.navn }}</h3>
          {{ block.sted.street1 }}<br />
          {{ block.sted.city }}, {{ block.sted.zip }}
      </div>
      <div>
          Latitude: {{ block.sted.lat }}<br />
          Longitude: {{ block.sted.lng }}
      </div>
  {% endfor %}
  
  <!-- results -->
  {% set target = craft.request.getParam('sted') %}
  {% set params = {
      target: target,
      range: 1000,
      units: "kilometers"
  } %}
  
  {% set blocks = entry.avdelinger(params).order('distance').find() %}
  
  <h2>Showing results for "{{ target }}"</h2>
  {% for block in blocks %}
      <div>
          {{ block.sted.street1 }}<br />
          {{ block.sted.city }}, {{ block.sted.zip }}<br>
          <strong>{{ block.sted.distance | number_format(2) }} kilometers away</strong>
      </div>
  {% else %}
      <h2>No results found</h2>
  {% endfor %}
  
  {% endblock %}
  
  ```
  
  Thanks!
  
  **Tags:** matrix, elementcriteriamodel, plugin-smartmap
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-16. Score: 2
  
  The syntax to set a custom field parameter on a Matrix Block element criteria model is like so:
  
  ```
  {% set blocks = entry.myMatrixField.mySmartMapField(params) %}
  
  ```
  
  
  ---
  
  