Answers.Body: <p>This feature has been added in <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/fields" rel="nofollow">Sprout Fields</a> v2.1.0</p>
  
  <p>You can now use the Email Select field via custom HTML and obfuscate email addresses. I've added <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/email-select-field" rel="nofollow">an example in the docs</a>:</p>
  
  <pre><code>{% set contact = craft.sproutForms.form('contact') %}
  
  {% set emailSelectField = contact.getField('emailSelect') %}
  
  &lt;select name="fields[{{ emailSelectField.handle }}]"&gt;
  
    {% set value = contact is defined ? contact.emailSelect.value : null %}
  
    {% set options = craft.sproutFields.obfuscateEmailAddresses(emailSelectField.settings.options, value) %}
  
    {% for option in options %}
  
      {% if value != "" %}
        {% set selected = (option.selected == 1) ? true : false %}
      {% else %}
        {% set selected = (option.default == 1) ? true : false %}
      {% endif %}
  
      &lt;option value="{{ option.value }}" {% if selected %}selected{% endif %}&gt;{{ option.label }}&lt;/option&gt;
  
    {% endfor %}
  
  &lt;/select&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-03T08:09:07.997Z
Answers.Text: I've somehow put myself in a situation where I have to pass the $option index in for the value attribute. I used loop.index0. It's better in our case because our option.values aren't unique, but option.value didn't work for us.
Answers.UserDisplayName: ponies
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-26T16:37:55.240Z
Answers.LastActivityDate: 2016-09-26T16:37:55.240Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I'm trying to customize the markup of an email select field in Sprout Forms, however, when I customize the markup with <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html" rel="nofollow">Custom HTML</a>, as specified in the documentation, it outputs the actual <code>value</code> rather than purging it to hide them from spam bots. I just need to know what I should include in the options to purge these. Here is the code I've been using.</p>
  
  <pre><code>{% set recipient = form.getField('emailRecipient') %}  
  &lt;select name="fields[{{ recipient.handle }}]"&gt;
    {% for option in recipient.settings.options %}
    &lt;option value="{{ option.value }}" {% if option.value == value.value %}selected{% endif %}&gt;{{ option.label }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-03T07:48:29.147Z
Comments.Text: This is likely a bug. I've added it to our list to look into and will update this thread once it's fixed.
Comments.UserDisplayName: Ben Parizek
Tags: <templating><plugin-sproutforms>
Title: Customize markup of email select field in Sprout Forms
ThreadText: # Customize markup of email select field in Sprout Forms
  
  (Asked by: username_0 on 2016-08-14)
  
  I'm trying to customize the markup of an email select field in Sprout Forms, however, when I customize the markup with [Custom HTML](http://sprout.barrelstrengthdesign.com/craft-plugins/forms/docs/examples/custom-html), as specified in the documentation, it outputs the actual `value` rather than purging it to hide them from spam bots. I just need to know what I should include in the options to purge these. Here is the code I've been using.
  
  ```
  {% set recipient = form.getField('emailRecipient') %}  
  <select name="fields[{{ recipient.handle }}]">
    {% for option in recipient.settings.options %}
    <option value="{{ option.value }}" {% if option.value == value.value %}selected{% endif %}>{{ option.label }}</option>
    {% endfor %}
  </select>
  
  ```
  
  Any help would be greatly appreciated!
  
  Thanks.
  
  **Tags:** templating, plugin-sproutforms
  
  > **Comments:**
  > **username_1**: This is likely a bug. I've added it to our list to look into and will update this thread once it's fixed.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-26. Score: 2
  
  This feature has been added in [Sprout Fields](http://sprout.barrelstrengthdesign.com/craft-plugins/fields) v2.1.0
  
  You can now use the Email Select field via custom HTML and obfuscate email addresses. I've added [an example in the docs](http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/email-select-field):
  
  ```
  {% set contact = craft.sproutForms.form('contact') %}
  
  {% set emailSelectField = contact.getField('emailSelect') %}
  
  <select name="fields[{{ emailSelectField.handle }}]">
  
    {% set value = contact is defined ? contact.emailSelect.value : null %}
  
    {% set options = craft.sproutFields.obfuscateEmailAddresses(emailSelectField.settings.options, value) %}
  
    {% for option in options %}
  
      {% if value != "" %}
        {% set selected = (option.selected == 1) ? true : false %}
      {% else %}
        {% set selected = (option.default == 1) ? true : false %}
      {% endif %}
  
      <option value="{{ option.value }}" {% if selected %}selected{% endif %}>{{ option.label }}</option>
  
    {% endfor %}
  
  </select>
  
  ```
  
  > **Comments:**
  > **username_2**: I've somehow put myself in a situation where I have to pass the $option index in for the value attribute. I used loop.index0. It's better in our case because our option.values aren't unique, but option.value didn't work for us.  
  
  ---
  
  