Formatting checkbox to unordered list in notification

I am trying to format a notification that looks like the following:

Scooter McGavin Referred from an OD just filled out their Intake Form

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
How I chose Brinton Vision:

  • My eye doctor recommended Brinton Vision
  • Internet search
  • Radio
  • Billboard

Who in the office told you about us: Doctor

Name of referring person:

The problem is that it always turns out like this:

Scooter McGavin Referred from an OD just filled out their Intake Form

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
How I chose Brinton Vision:
My eye doctor recommended Brinton Vision, Internet search, Radio, Billboard
Who in the office told you about us: Doctor

Name of referring person:

Is there a way to make one merge code that creates an unordered list? My code is below, any help would be appreciated.

{First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285} was referred to Brinton Vision by their eye doctor

Name: {First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285}
Preferred Name: {Preferred name or nickname:210}
DOB: {Date of Birth (as on government issued ID):622} Age: {Age:280}

Referring eye doctor: {If your eye doctor referred you to Brinton Vision, please provide the doctor’s name and practice information here.:445}
Years seeing eye doctor: {For how many years have you seen this doctor for clinic exams?:624}
How I chose Brinton Vision:

{Where have you heard about Brinton Vision? Choose all that apply.:115}

Who in the office told you about us: {Who in the doctor’s office told you about Brinton Vision?:625}

Name of referring person: {Could you tell us their name so we can thank them?:626}

<ul> 
    <li>{If your eye doctor referred you to Brenton Vision, please provide the doctor’s name and practice information here.:445}</li>
    <li>{Where have you heard about Brinton Vision? Choose all that apply.:115.1}</li>
    <li>{Where have you heard about Brinton Vision? Choose all that apply.:115.2}</li>
    <li>{Where have you heard about Brinton Vision? Choose all that apply.:115.3}</li>
</ul>

I added some merge tag modifiers and some basic HTML for creating an unordered list. If the modifiers don’t work please see this article for additional information Merge tag modifiers

Hi Derek, thank you for helping. The following is the output I get when formatting the way you showed me:

2021-12-29 07_10_10-OD Referral - info@brintonvision.com - Brinton Vision Mail

There are nine different checkboxes and I only want the ones checked to show.

Thank you,
Jason

You can’t hide the list style type (bullet points).

With the ul formatting you will always see the bullet point even if the checkbox wasn’t clicked.

Give me a bit of time and I’ll see if I can create a CSS solution for you that won’t show the bullet points when the checkbox isn’t checked.

You can make use of the filter gform_merge_tag_filter to control how the checkbox outputs its data. See example 12. Output Checkboxes field as list.

1 Like

Never mind then. Looks like you have a solution by a Gravity Forms support engineer.

1 Like

:slightly_smiling_face: The method you outlined would also work if folks want to stay away from the code side of things. You could introduce several Conditional Shortcodes to hide the items that aren’t checked.

Hi Joshua, thank you for helping me with this. I am extremely wet behind the ears when it comes to Gravity Forms. I added the filter to functions.php and obviously do not know what to put in the actual text?

How I chose Brinton Vision:
{Where have you heard about Brinton Vision? Choose all that apply.:list:checkbox:115}

Hi Joshua, I tried this method and the formatting is still off. My code is below.

{First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285} was referred to Brinton Vision by their eye doctor

Name: {First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285}
Preferred Name: {Preferred name or nickname:210}
DOB: {Date of Birth (as on government issued ID):622} Age: {Age:280}

Referring eye doctor: {If your eye doctor referred you to Brinton Vision, please provide the doctor's name and practice information here.:445}
Years seeing eye doctor: {For how many years have you seen this doctor for clinic exams?:624}
Who in the office told you about us: {Who in the doctor’s office told you about Brinton Vision?:625}
Name of referring person: {Could you tell us their name so we can thank them?:626}

How I chose Brinton Vision:
[gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.1}” condition=“isnot” value=“”]

  • Word of mouth
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.2}” condition=“isnot” value=“”]
  • My eye doctor recommended Brinton Vision
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.3}” condition=“isnot” value=“”]
  • Internet search
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.4}” condition=“isnot” value=“”]
  • Internet ad
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.5}” condition=“isnot” value=“”]
  • Social media
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.6}” condition=“isnot” value=“”]
  • Radio
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.7}” condition=“isnot” value=“”]
  • Billboard
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.8}” condition=“isnot” value=“”]
  • Magazine
    [/gravityforms]
    [gravityforms action=“conditional” merge_tag=“{Where have you heard about Brinton Vision? Choose all that apply.:list:115.9}” condition=“isnot” value=“”]
  • Other
    [/gravityforms]

The output looks like this, which is close to what I want.

But I need it more condensed like the following:

Scooter McGavin was referred to Brinton Vision by their eye doctor

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
Who in the office told you about us: Doctor
Name of referring person:

How I chose Brinton Vision:

  • My eye doctor recommended Brinton Vision
  • Internet search
  • Radio
  • Billboard

Once the code snippet is in place, you can use the following merge tag and modifier combo to get the list display:

How I chose Brinton Vision:
{Heard about from:115:list}

Thank you Joshua, I don’t know what I’m missing? My functions.php file is below:

<?php
/*
Author: Ole Fredrik Lie
URL: http://olefredrik.com
*/


// Various clean up functions
require_once('library/cleanup.php');

// Required for Foundation to work properly
require_once('library/foundation.php');

// Register all navigation menus
require_once('library/navigation.php');

// Add menu walkers
require_once('library/menu-walker.php');
//require_once('library/offcanvas-walker.php');
require_once('library/accordion-menu-walker.php');

// Create widget areas in sidebar and footer
require_once('library/widget-areas.php');

// Return entry meta information for posts
require_once('library/entry-meta.php');

// Enqueue scripts
require_once('library/enqueue-scripts.php');

// Add theme support
require_once('library/theme-support.php');

// Add Header image
require_once('library/custom-header.php');

/** Add ACF Options Pages **/

if(function_exists('acf_add_options_page')){
	acf_add_options_page(array(
        'page_title' => 'Global Options',
        'menu_title' => 'Global Options',
        'position' => '4.1',
        'icon_url' => 'dashicons-admin-generic'
    ));
    acf_add_options_page(array(
        'page_title' => 'Header Options',
        'menu_title' => 'Header Options',
        'position' => '4.2',
        'icon_url' => 'dashicons-editor-table'
    ));
//    acf_add_options_page(array(
//        'page_title' => 'Footer Options',
//        'menu_title' => 'Footer Options',
//        'position' => '4.3',
//       'icon_url' => 'dashicons-slides'
//    ));
//    acf_add_options_page(array(
//        'page_title' => 'Page Options',
//        'menu_title' => 'Page Options',
//        'position' => '4.4',
//        'icon_url' => 'dashicons-schedule'
//    ));
    acf_add_options_page(array(
        'page_title' => 'Homepage Options',
        'menu_title' => 'Homepage Options',
        'position' => '4.5',
        'icon_url' => 'dashicons-desktop'
    ));
}

add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
    if ( $field->type == 'checkbox' && $modifier == 'list' && ! empty( $raw_value ) ) {
 
        $items = '';
 
        foreach ( $raw_value as $key => $item ) {
            if ( ! rgblank( $item ) ) {
                        $items .= '<li>' . wp_kses_post( GFCommon::selection_display( $item, $field, '', true ) ) . '</li>';
            }
        }
 
        if ( empty( $items ) ) {
            $value = '';
        } else {
            $value = "<ul class='bulleted'>$items</ul>";
        }
 
    }
 
    return $value;
}, 10, 6 );

add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );


add_theme_support( 'title-tag' );

function new_excerpt_more( $more ) {
    return ' ...';
}
add_filter('excerpt_more', 'new_excerpt_more');

// Shortcode function button link
function acg_button_shortcode( $atts ) {
   $a = shortcode_atts( array(
      'url' 	=> '#',
      'text' 	=> 'Button',
      'target' 	=> '',
      'color' 	=> '',
      'align'	=> 'text-left',
      'width'   => ''
   ), $atts );
   return '<div class="' . $a['align'] . '"><a href="' . $a['url'] . '" target="' . $a['text'] . '" class="button '. $a['color'] .'" style="width:'. $a['width'] .';">' . $a['text'] . '</a></div>';
}
add_shortcode( 'acgbutton', 'acg_button_shortcode' );

//[acgbutton url="/give/" align="text-center" text="Give Now"]

// Loads Pricing Calculator
include_once 'functions-calculator.php';

//Loads Stats Counter
include_once 'functions-stats.php';

/*  Add responsive container to embeds
/* ------------------------------------ */ 
function alx_embed_html( $html ) {
    return '<div class="video-container">' . $html . '</div>';
}
 
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'alx_embed_html' );
// Pagination Fix...
function bamboo_request($query_string )
{
    if( isset( $query_string['page'] ) ) {
        if( ''!=$query_string['page'] ) {
            if( isset( $query_string['name'] ) ) {
                unset( $query_string['name'] );
            }
        }
    }
    return $query_string;
}
/*
add_filter('request', 'bamboo_request');

add_action('pre_get_posts','bamboo_pre_get_posts');
function bamboo_pre_get_posts( $query ) { 
    if( $query->is_main_query() && !$query->is_feed() && !is_admin() ) { 
        $query->set( 'paged', str_replace( '/', '', get_query_var( 'page' ) ) ); 
    } 
}
*/

// Function that will return our Wordpress menu
function rle_menu($atts, $content = null) {
  extract(shortcode_atts(array(  
    'menu'            => '', 
    'container'       => 'div', 
    'container_class' => '', 
    'container_id'    => '', 
    'menu_class'      => 'menu', 
    'menu_id'         => '',
    'echo'            => true,
    'fallback_cb'     => 'wp_page_menu',
    'before'          => '',
    'after'           => '',
    'link_before'     => '',
    'link_after'      => '',
    'depth'           => 0,
    'walker'          => '',
    'theme_location'  => ''), 
    $atts));
 
 
  return wp_nav_menu( array( 
    'menu'            => $menu, 
    'container'       => $container, 
    'container_class' => $container_class, 
    'container_id'    => $container_id, 
    'menu_class'      => $menu_class, 
    'menu_id'         => $menu_id,
    'echo'            => false,
    'fallback_cb'     => $fallback_cb,
    'before'          => $before,
    'after'           => $after,
    'link_before'     => $link_before,
    'link_after'      => $link_after,
    'depth'           => $depth,
    'walker'          => $walker,
    'theme_location'  => $theme_location));
}
//Create the shortcode
add_shortcode("rlemenu", "rle_menu");


?>

My message code is below:

<strong>{First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285} was referred to Brinton Vision by their eye doctor</strong>

Name: {First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285}
Preferred Name: {Preferred name or nickname:210}
DOB: {Date of Birth (as on government issued ID):622} Age: {Age:280}

Referring eye doctor: {If your eye doctor referred you to Brinton Vision, please provide the doctor\'s name and practice information here.:445}
Years seeing eye doctor: {For how many years have you seen this doctor for clinic exams?:624}
Who in the office told you about us: {Who in the doctor’s office told you about Brinton Vision?:625}
Name of referring person: {Could you tell us their name so we can thank them?:626}

How I chose Brinton Vision:
{Heard about from:115:list}

My output is below:

Scooter McGavin was referred to Brinton Vision by their eye doctor

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
Who in the office told you about us: Doctor
Name of referring person:

How I chose Brinton Vision:
My eye doctor recommended Brinton Vision, Internet search, Radio, Billboard

Thank you for your help with this.

@user5f286751995e0328 I’m on a mobile device so let me know if this works. I know it isn’t as complex but in theory it should work. In the notification click text and paste in the style tags at the top of the notification.


    <span class=“item”>{If your eye doctor referred you to Brenton Vision, please provide the doctor’s name and practice information here.:445}</span>
    <span class=“item”>{Where have you heard about Brinton Vision? Choose all that apply.:115.1}</span>
    <span class=“item”>{Where have you heard about Brinton Vision? Choose all that apply.:115.2}</span>
    <span class=“item”>Where have you heard about Brinton Vision? Choose all that apply.:115.3}</span>

<style>
.item::before{content:’•’;}
.item:empty{display:none;}
</style>

Hi Derek,

Almost, my output is below:

Scooter McGavin was referred to Brinton Vision by their eye doctor

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
Who in the office told you about us: Doctor
Name of referring person:

How I chose Brinton Vision:

My eye doctor recommended Brinton Vision
Internet search

Radio
Billboard

Code is below:

<style>
.item::before{content:’•’;}<br />
.item:empty{display:none;}<br />
</style>

<strong>{First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285} was referred to Brinton Vision by their eye doctor</strong>

Name: {First and middle names (as on government issued ID):206} {Last name (as on government issued ID):285}
Preferred Name: {Preferred name or nickname:210}
DOB: {Date of Birth (as on government issued ID):622} Age: {Age:280}

Referring eye doctor: {If your eye doctor referred you to Brinton Vision, please provide the doctor\'s name and practice information here.:445}
Years seeing eye doctor: {For how many years have you seen this doctor for clinic exams?:624}
Who in the office told you about us: {Who in the doctor’s office told you about Brinton Vision?:625}
Name of referring person: {Could you tell us their name so we can thank them?:626}

How I chose Brinton Vision:
<span class="“item”">{:115.1}</span>
<span class="“item”">{:115.2}</span>
<span class="“item”">{:115.3}</span>
<span class="“item”">{:115.4}</span>
<span class="“item”">{:115.5}</span>
<span class="“item”">{:115.6}</span>
<span class="“item”">{:115.7}</span>
<span class="“item”">{:115.8}</span>
<span class="“item”">{:115.9}</span>

@user5f286751995e0328

Where it says item please get rid of the funky “”

class=“”item”” should just have one quote around the word item.

Please update the style tag to add a color for the bullet.

<style>
    .item::before{content:"•";color= "black";}
    .item:empty{display:none;}
</style>

Sorry I’m a mobile device.

Hi Derek,

Output is the same with the modification.

Best,
Jason

@user5f286751995e0328 lets update the html and style tag to below. I’ve just added the bullet to before the field and removed the content rule in the css.

Updated HTML

<span class="item">• {:115.1}</span>

Updated CSS

<style> 
     .item:empty{display:none;}
</style>

That creates an output like this:

Name: Scooter McGavin
Preferred Name: Scooter
DOB: 01/01/1965 Age: 56

Referring eye doctor: Taylor Chesnut
Years seeing eye doctor: 1-2 years
Who in the office told you about us: Doctor
Name of referring person:

How I chose Brinton Vision:
•
•My eye doctor recommended Brinton Vision
•Internet search
•
•
•Radio
•Billboard
•
•

@user5f286751995e0328 give me a few hours to get on a computer and run a quick test. The item::empty display none might need an !important added to it. Sorry not trying to make you a guinea pig.

In the mean time can you disable the auto formatting option. I see some issues with the code and it’s not what I am providing to you. I think the editor maybe auto adding some characters.

Thank you Derek, I appreciate all the help you are giving me. I don’t mind being a guinea pig!

Best,
Jason

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.