HTML type

HTML type documentation.

Overview

This field type is designed to store HTML code. It will display a user-friendly text editor in edit mode and render as HTML in read-only mode.

However, it’s essential to note that, for security reasons, HTML code will undergo stripping. Only the following tags are allowed:

<a href="ftp|http|https|mailto" title="">
<b>
<blockquote cite="http|https">
<br>
<caption>
<cite>
<code>
<col span="" width="">
<colgroup span="" width="">
<dd>
<div>
<dl>
<dt>
<em>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<i>
<img align="" alt="" height="" src="http|https" title="" width="">
<li>
<ol start="" type="">
<p>
<pre>
<q cite="http|https">
<small>
<strike>
<strong
<sub>
<sup>
<table summary="" width="">
<tbody>
<td abbr="" axis="" colspan="" rowspan="" width="">
<tfoot>
<th abbr="" axis="" colspan="" rowspan="" scope="" width="">
<thead>
<tr>
<u>
<ul type="">
<span>
<div>
<hr>

Apart from those specific attributes, the "class" attribute is allowed for all tags.

Available features

NameSupported
Many multiplicityyes
Default valuesyes
Unique flagyes
Required flagyes
Indexable flagyes
Sensitive flagyes
Calculated valueyes
Automatic initializationno
Calculated initial valueno
Aggregationno
Default type rulesno
Default display optionsyes

Display options

Limit number of characters

Enabling this option will restrict the number of characters displayed, accompanied by a "More" button to expand the content.

Please note that this option only takes effect when the field is in read-only mode.

REST API

Read format

The format is the plain HTML code:

"notes": "<p>test <span style=\"background-color: yellow; font-weight: bold;\">html</span> text</p>"

Write format

You should provide a HTML code:

"notes": "<p>test <span style=\"background-color: yellow; font-weight: bold;\">html</span> text</p>"

Keep in mind that HTML code sent will be stripped out as explained above in the overview.

JavaScript API

Read format

The val() method within the wrapper will return a plain HTML code:

// this will print something like "<p>test</p>"
log('notes: '+record.field('notes').val());

Write format

To set the value, you should provide a plain string:

record.field('notes').val('<p>test <span style="background-color: yellow; font-weight: bold;">html</span> text</p>');

Export/Import

Export format

The export format is a simple string with the HTML code:

"htmlField"
"<strong>title</strong><p>blah blah</p>"

Import format

The import format is a simple string with the HTML code:

"htmlField"
"<strong>title</strong><p>blah blah</p>"

Queries

For more information, please refer to the Query Language Documentation.

Available operators

OperatorSupported
equalsyes
notEqualsyes
emptyyes
notEmptyyes
likeyes
greateryes
greaterOrEqualsyes
lessyes
lessOrEqualsyes
betweenyes
currentUserFieldno

Query formats

You should provide the email as a plain HTML. For example:

// Finds companies where notes have the word 'test' 
var records_sample = sys.data.find('companies', {'notes': 'like(test)'});
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// Finds companies where notes have the word 'test' 
var query_sample = sys.data.createQuery('companies')
    .field('notes').like('test')
var records_sample = sys.data.find(query_sample);
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// Finds companies where notes have the word 'test' 
GET /data/contacts?notes=like(test)

Please be aware that searches will be conducted against the plain text version of the field. For instance, if you have a tag with a class name “test,” the query mentioned above will not match it because it is not part of the visible text content of the HTML.

Aggregate queries

Please refer to the Aggregate Queries Documentation for more detailed information.

Available operators

OperatorSupported
sumno
avgno
firstyes
lastyes
minyes
maxyes

UI queries

Please refer to the UI Queries Documentation for more detailed information.

Matching of values

PropertyDescription
Matching operatorlike

Available operators

OperatorSupported
Many valuesyes
Greaterno
Greater or equalsno
Lessyes
Less or equalsyes
Betweenno