Modifier :sanitize_html_class
Make it CSS class names. Example: {Company:101:sanitize_html_class} gives Acme Widgets Co bNorthb Branch serving the Tri-County area since 1923. On the test form, this field is {Company:101} (Single line text).
About
Removes the characters a class name cannot hold. Spaces stay, so each word becomes a class of its own.
Works in any merge tag while GravityView is active, including Gravity Forms notifications.
| Product | GravityView |
|---|---|
| Requires | GravityView 2.0 or later |
| In the picker | Change the output, for form fields |
How to use it
Turn a value into CSS classes
Removes punctuation and keeps spaces, so each word is a class. Style entries by what someone chose.
Write
<div class="{Tags:4:sanitize_html_class}">…</div>Get
<div class="red green blue">…</div>Examples
Output from the real plugin code, run on a test entry.
| Merge tag | Output | Without the modifier |
|---|---|---|
{Notes:2:sanitize_html_class} | its -- bQUICKb brown Fox jumps over the lazy dog and it wasnt bthatb slow steadyAda Lovelace wrote the first algorithm | it's -- <b>QUICK</b>, brown Fox jumps over the lazy dog and it wasn't <b>that</b> slow & steady.<br /> <br /> Ada Lovelace wrote the first algorithm. |
Works on
Form fields: Single line text · Paragraph text · Email · Website · Hidden · Signature · Drop down · Radio buttons · Checkboxes, one choice · Multi select · Image choice · Multiple choice · Post category · Number · Product · Product price · Quantity · Option · Shipping · Shipping (single) · Total · Date, after a custom format · Time · Name, one part · Address, one part · Phone, standard format · File upload · Post image · List.
Left out
| Field kinds | Why |
|---|---|
| Consent · Calculation · Product (single) · Product (hidden) · Name · Address | Outputs nothing on the whole field. Gravity Forms has no single value for this field as a whole, so the tag outputs nothing and so does any modifier. Use one part instead, like .3 for a first name. |
| Checkboxes · Repeater | Skipped on the whole field. This field is stored as several values, which GravityView skips and GravityMath cannot total. Use one input instead, like .3 for a first name. |
| Date | Needs a date format first. GravityView would change the stored date (2024-03-19), which has no letters. Add “Custom date format” or “Relative time” first. |
| Phone, international format | Works on the stored record. An international phone field stores a record like {"country":"US",…}. GravityView would change that record, not the number people see. |