Skip to main content

Modifier: :esc_html

Escape HTML. Write it after a colon: {Link:4:esc_html}

About

ProductGravityView
RequiresGravityView 2.0 or later
Works onform fields
In the pickerChange the output

How to use it

Put a value inside an HTML attribute

Quotes and angle brackets in the value would end the attribute early and break the HTML. Escaped, they display as written.

Write

<a href="https://example.com/" title="{Notes:2:esc_html}">Read the notes</a>

Get

<a href="https://example.com/" title="it&#039;s -- &lt;b&gt;QUICK&lt;/b&gt;, brown Fox jumps over the lazy dog and it wasn&#039;t &lt;b&gt;that&lt;/b&gt; slow &amp; steady.

Ada Lovelace wrote the first algorithm.">Read the notes</a>

Examples

Rendered by real Gravity Forms and GravityKit PHP against a test entry.

Merge tagOutputWithout the modifier
{Notes:2:esc_html}it&#039;s -- &lt;b&gt;QUICK&lt;/b&gt;, brown Fox jumps over the lazy dog and it wasn&#039;t &lt;b&gt;that&lt;/b&gt; slow &amp; steady. Ada Lovelace wrote the first algorithm.it&#039;s -- &lt;b&gt;QUICK&lt;/b&gt;, brown Fox jumps over the lazy dog and it wasn&#039;t &lt;b&gt;that&lt;/b&gt; slow &amp; steady.<br /> <br /> Ada Lovelace wrote the first algorithm.

Where the merge tag picker offers it

Form fields: Single line text · Paragraph text · Email · Website · Hidden · Consent · Signature · Drop down · Radio buttons · Checkboxes, one choice · Multi select · Image choice · Multiple choice · Post category · Calculation · Product · Product (single) · Product (hidden) · Product price · Option · Shipping · Shipping (single) · Date, after a custom format · Time · Name, one part · Address, one part · Phone, standard format · File upload · Post image · List · Repeater.

Where it is left out

Field kindsWhy
Checkboxes · Name · AddressSkipped on the whole field. The field is stored as several values, and GravityView skips it. Write one input instead, like .3 for a first name.
Number · Quantity · TotalChanges nothing on this field. A number has no letters and is one word, so case changes, word limits and escaping leave it as it is.
DateNeeds a date format first. GravityView changes the stored date (2024-03-09), which has no letters. Add “Custom date format” or “Human-readable time difference” first.
Phone, international formatWorks on the stored record. An international phone field stores a record like {"country":"US",…}. GravityView would change that record, not the number people see.