<p>This had me stumped for a while, but it turned out to be a custom fieldtype extending <code>BaseElementFieldType</code>, in which the settings attribute <code>targetLocaleField</code> apparently was renamed <code>targetLocaleFieldHtml</code> with Craft <a href="https://github.com/pixelandtonic/Craft-Release/commit/ec08c2a41ccb6e37b9b5309eb9bc768725effd65?diff=split" rel="nofollow">2.5.2750</a>.</p>

<p>Not sure why the error was thrown for all fields and fieldtypes (even PlainText fields), but in any case the fix was simply replacing the <code>targetLocaleField</code> attribute with <code>targetLocaleFieldHtml</code> in the returned array for the <code>getSettingsHtml()</code> method in the custom fieldtype.</p>

<p><strong>Edit:</strong> It just occurred to me that the reason for getting the error on all fields/fieldtypes is – of course – due to Craft actually pre-rendering the settings templates for <em>all fieldtypes</em>, I assume to make changing the fieldtype (via the dropdown) seamless/instantaneous.</p>

CC BY-SA 3.0
2016-06-06T18:54:29.753Z
2016-06-08T11:45:01.793Z
2016-06-08T11:45:01.793Z
Mats Mikkel Rummelhoff
<p>After upgrading a site from 2.4.x to 2.6.x, I'm experiencing an odd issue where Craft throws the following template error whenever I attempt to edit a field:</p>

<p><code>Variable "targetLocaleFieldHtml" does not exist</code></p>

<p>The error message only displays if <code>devMode</code> is set to <code>true</code>, occurs for all fields and fieldtypes (also when attempting to create a new field), and prevents me from actually editing field settings (unless I turn off <code>devMode</code>).</p>

<p>Here's the full stack trace:</p>

<pre><code>Template Error

Variable "targetLocaleFieldHtml" does not exist

/somepath/craft/app/templates/_components/fieldtypes/elementfieldsettings.html(33)

21                     options: sources,
22                     value: settings.source
23                 }) }}
24             {% endif %}
25         {% else %}
26             {{ forms.field({
27                 label: (allowMultipleSources ? "Sources"|t : "Source"|t)
28             }, '&lt;p class="error"&gt;' ~ "No sources exist yet."|t ~ '&lt;/p&gt;') }}
29         {% endif %}
30     {% endblock %}
31 
32     {% block targetLocaleField %}
33         {{ targetLocaleFieldHtml|raw }}
34     {% endblock %}
35 
36     {% block limitField %}
37         {% if allowLimit %}
38             {{ forms.textField({
39                 label: "Limit"|t,
40                 instructions: "Limit the number of selectable {type}."|t({ type: type|lower }),
41                 id: 'limit',
42                 name: 'limit',
43                 value: settings.limit,
44                 size: 2,
45                 errors: settings.getErrors('limit')
2016-06-06 18:44:40 Apache / Craft 2.6.2789
</code></pre>

<error-message><fieldtypes><settings>
Odd error message when editing field settings (Variable "targetLocaleFieldHtml" does not exist)
# Odd error message when editing field settings (Variable "targetLocaleFieldHtml" does not exist)

(Asked by: username_0 on 2016-06-06)

After upgrading a site from 2.4.x to 2.6.x, I'm experiencing an odd issue where Craft throws the following template error whenever I attempt to edit a field:
Variable "targetLocaleFieldHtml" does not exist
The error message only displays if devMode is set to true, occurs for all fields and fieldtypes (also when attempting to create a new field), and prevents me from actually editing field settings (unless I turn off devMode).
Here's the full stack trace:
Template Error

Variable "targetLocaleFieldHtml" does not exist

/somepath/craft/app/templates/_components/fieldtypes/elementfieldsettings.html(33)

21                     options: sources,
22                     value: settings.source
23                 }) }}
24             {% endif %}
25         {% else %}
26             {{ forms.field({
27                 label: (allowMultipleSources ? "Sources"|t : "Source"|t)
28             }, '' ~ "No sources exist yet."|t ~ '') }}
29         {% endif %}
30     {% endblock %}
31 
32     {% block targetLocaleField %}
33         {{ targetLocaleFieldHtml|raw }}
34     {% endblock %}
35 
36     {% block limitField %}
37         {% if allowLimit %}
38             {{ forms.textField({
39                 label: "Limit"|t,
40                 instructions: "Limit the number of selectable {type}."|t({ type: type|lower }),
41                 id: 'limit',
42                 name: 'limit',
43                 value: settings.limit,
44                 size: 2,
45                 errors: settings.getErrors('limit')
2016-06-06 18:44:40 Apache / Craft 2.6.2789

**Tags:** error-message, fieldtypes, settings


---

## 1 answers

### Answer by username_0 on 2016-06-06. Score: 2 | Accepted answer

This had me stumped for a while, but it turned out to be a custom fieldtype extending `BaseElementFieldType`, in which the settings attribute `targetLocaleField` apparently was renamed `targetLocaleFieldHtml` with Craft [2.5.2750](https://github.com/pixelandtonic/Craft-Release/commit/ec08c2a41ccb6e37b9b5309eb9bc768725effd65?diff=split).

Not sure why the error was thrown for all fields and fieldtypes (even PlainText fields), but in any case the fix was simply replacing the `targetLocaleField` attribute with `targetLocaleFieldHtml` in the returned array for the `getSettingsHtml()` method in the custom fieldtype.

**Edit:** It just occurred to me that the reason for getting the error on all fields/fieldtypes is – of course – due to Craft actually pre-rendering the settings templates for *all fieldtypes*, I assume to make changing the fieldtype (via the dropdown) seamless/instantaneous.


---

