Answers.Body: <p>Have you tried any of the following before submitting the TextArea?</p>
  
  <ol>
  <li><p>Highlight the code portion and Ctrl + K or Command K</p></li>
  <li><p>Indent the code lines 4 spaces</p></li>
  <li><p>Use backtics ' your html ' </p></li>
  <li><p>Use code tag <code>&lt;code&gt;your html&lt;/code&gt;</code>  </p></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-10T02:04:17.227Z
Answers.LastActivityDate: 2017-03-10T02:04:17.227Z
Answers.UserDisplayName: Iowa Boy
Answers.Body: <p>This appears to be unsupported in the API, which encodes all HTML values. I've created a JIRA issue to request this functionality: <a href="https://issues.civicrm.org/jira/browse/CRM-21572" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-21572</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-16T21:51:26.323Z
Answers.LastActivityDate: 2017-12-16T21:51:26.323Z
Answers.UserDisplayName: TwoMice
Body: <p>I have a custom field with data type 'Note' and field type 'TextArea'. When I insert a value using the CiviCRM interface, I can insert text via an editor, and bold text gets displayed as bold, italic etc.</p>
  
  <p>Now I want to put html in this same field using the API, but the problem is that any html characters are converted to html entities when inserted.</p>
  
  <pre><code>  $params = array(
    'contact_id' =&gt; $contact_id,
    'entity_id' =&gt; $contact_id,
    'custom_' . $content_field_id =&gt; '&lt;div class="note_content"&gt;' . implode('&lt;/div&gt;&lt;div class="note_content"&gt;', $data['note_content']) . '&lt;/div&gt;',
  );
  $create_note_result = $spcivi-&gt;api('CustomValue', 'create', $params);
  </code></pre>
  
  <p>html send via api:</p>
  
  <pre><code>&lt;div class="note_content"&gt;&lt;strong&gt;Vette&lt;/strong&gt; tekst is toegestaan!&lt;/div&gt;&lt;div class="note_content"&gt;&lt;em&gt;Shuine&lt;/em&gt; ook!&lt;/div&gt;
  </code></pre>
  
  <p>result content in field:</p>
  
  <pre><code>&amp;lt;div class="note_content"&amp;gt;&amp;lt;strong&amp;gt;Vette&amp;lt;/strong&amp;gt; tekst is toegestaan!&amp;lt;/div&amp;gt;&amp;lt;div class="note_content"&amp;gt;&amp;lt;em&amp;gt;Shuine&amp;lt;/em&amp;gt; ook!&amp;lt;/div&amp;gt;
  </code></pre>
  
  <p>Is there a way to insert html without the html characters being converted to html entities? Using the field type TextArea becomes quite useless when not html can be inserted.</p>
  
Tags: <custom-fields><api><html>
Title: How to Insert html in custom field (type TextArea) via API
ThreadText: # How to Insert html in custom field (type TextArea) via API
  
  (Asked by: username_0 on 2017-02-15)
  
  I have a custom field with data type 'Note' and field type 'TextArea'. When I insert a value using the CiviCRM interface, I can insert text via an editor, and bold text gets displayed as bold, italic etc.
  Now I want to put html in this same field using the API, but the problem is that any html characters are converted to html entities when inserted.
    $params = array(
    'contact_id' => $contact_id,
    'entity_id' => $contact_id,
    'custom_' . $content_field_id => '' . implode('', $data['note_content']) . '',
  );
  $create_note_result = $spcivi->api('CustomValue', 'create', $params);
  
  html send via api:
  Vette tekst is toegestaan!Shuine ook!
  
  result content in field:
  <div class="note_content"><strong>Vette</strong> tekst is toegestaan!</div><div class="note_content"><em>Shuine</em> ook!</div>
  
  Is there a way to insert html without the html characters being converted to html entities? Using the field type TextArea becomes quite useless when not html can be inserted.
  
  **Tags:** custom-fields, api, html
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-03-10. Score: 1
  
  Have you tried any of the following before submitting the TextArea?
  
  1. Highlight the code portion and Ctrl + K or Command K
  2. Indent the code lines 4 spaces
  3. Use backtics ' your html '
  4. Use code tag `your html`
  
  
  ---
  
  ### Answer by username_2 on 2017-12-16. Score: 1
  
  This appears to be unsupported in the API, which encodes all HTML values. I've created a JIRA issue to request this functionality: <https://issues.civicrm.org/jira/browse/CRM-21572>
  
  
  ---
  
  