<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Unnecessary esc_html() in get_checkbox_choices()?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices</link>
		<description>Gravity Support Forums Topic: Unnecessary esc_html() in get_checkbox_choices()?</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:16:43 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/unnecessary-esc_html-in-get_checkbox_choices" rel="self" type="application/rss+xml" />

		<item>
			<title>m4change on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-16789</link>
			<pubDate>Fri, 21 Jan 2011 15:47:49 +0000</pubDate>
			<dc:creator>m4change</dc:creator>
			<guid isPermaLink="false">16789@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Just an update for those of you still looking to hack up gforms to allow this, as of RC3,&#60;/p&#62;
&#60;p&#62;---&#60;br /&#62;
in common.php:&#60;/p&#62;
&#60;p&#62;find 'public static function get_checkbox_choices($field, $value, $disabled_text){'&#60;/p&#62;
&#60;p&#62;at 1114: replace esc_html($choice[&#34;text&#34;]) with $choice[&#34;text&#34;]&#60;br /&#62;
at 1145: replace esc_html($choice[&#34;text&#34;]) with $choice[&#34;text&#34;]&#60;/p&#62;
&#60;p&#62;------&#60;br /&#62;
in js.php:&#60;/p&#62;
&#60;p&#62;find 'function GetFieldChoices(field){'&#60;/p&#62;
&#60;p&#62;~lines 2094-2101 replace \&#34; with '
&#60;/p&#62;</description>
		</item>
		<item>
			<title>m4change on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-12843</link>
			<pubDate>Wed, 17 Nov 2010 17:45:53 +0000</pubDate>
			<dc:creator>m4change</dc:creator>
			<guid isPermaLink="false">12843@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I just ran across this issue and I do agree it's a bit of a pain and I hate to rely on javascript but the admin editor certainly does break when you inject HTML.&#60;/p&#62;
&#60;p&#62;edit: I'm the big jerk that just broke the rules and edited my common.php lines 1054 and 1008 to remove the esc_html() function&#60;/p&#62;
&#60;p&#62;and js.php lines 2001-2004 to change \&#34; to '&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;str += &#38;quot;&#38;lt;li&#38;gt;&#38;lt;input type=&#38;#39;&#38;quot; + type + &#38;quot;&#38;#39; class=&#38;#39;gfield_choice_&#38;quot; + type + &#38;quot;&#38;#39; name=&#38;#39;choice_selected&#38;#39; id=&#38;#39;choice_selected_&#38;quot; + i + &#38;quot;&#38;#39; &#38;quot; + checked + &#38;quot; onclick=&#38;#39;SetFieldChoice(&#38;quot; + i + &#38;quot;);&#38;#39; /&#38;gt;&#38;quot;;
        str +=     &#38;quot;&#38;lt;input type=&#38;#39;text&#38;#39; id=&#38;#39;choice_text_&#38;quot; + i + &#38;quot;&#38;#39; value=&#38;#39;&#38;quot; + field.choices[i].text + &#38;quot;&#38;#39; onkeyup=\&#38;quot;SetFieldChoice(&#38;quot; + i + &#38;quot;);\&#38;quot; class=&#38;#39;field-choice-input field-choice-text&#38;#39; /&#38;gt;&#38;quot;;
        str +=     &#38;quot;&#38;lt;input type=&#38;#39;text&#38;#39; id=&#38;#39;choice_value_&#38;quot; + i + &#38;quot;&#38;#39; value=&#38;#39;&#38;quot; + value + &#38;quot;&#38;#39; onkeyup=\&#38;quot;SetFieldChoice(&#38;quot; + i + &#38;quot;);\&#38;quot; class=&#38;#39;field-choice-input field-choice-value&#38;#39; /&#38;gt;&#38;quot;;
        str +=     &#38;quot;&#38;lt;input type=&#38;#39;text&#38;#39; id=&#38;#39;choice_price_&#38;quot; + i + &#38;quot;&#38;#39; value=&#38;#39;&#38;quot; + price + &#38;quot;&#38;#39; onchange=\&#38;quot;SetFieldChoice(&#38;quot; + i + &#38;quot;);\&#38;quot; class=&#38;#39;field-choice-input field-choice-price&#38;#39; /&#38;gt;&#38;quot;;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>dbone on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-6062</link>
			<pubDate>Thu, 03 Jun 2010 16:43:59 +0000</pubDate>
			<dc:creator>dbone</dc:creator>
			<guid isPermaLink="false">6062@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Created this JS to use in the interim until support is added in core. Obviously change the identifier to the classes for your checkbox list in your form in the for loop.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Unescape
for (i = 1; i &#38;lt;= 8; i++)
{
	unescape_html(&#38;quot;li.gchoice_21_&#38;quot; + i + &#38;quot; label&#38;quot;);
}

function unescape_html(node)
{
	var escaped_string = $(node).html();
	$(node).html(unescape_string(escaped_string));
}

function unescape_string(html)
{
	var htmlNode = document.createElement(&#38;quot;span&#38;quot;);
	htmlNode.innerHTML = html;
	if(htmlNode.innerText !== undefined)
	return htmlNode.innerText; // IE
	return htmlNode.textContent; // FF
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Credit to Marcus Phillips on &#60;a href=&#34;http://erlend.oftedal.no/blog/?blogid=14&#34; rel=&#34;nofollow&#34;&#62;http://erlend.oftedal.no/blog/?blogid=14&#60;/a&#62; for the unescape_string function.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sc0ttkclark on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-5790</link>
			<pubDate>Wed, 26 May 2010 13:20:42 +0000</pubDate>
			<dc:creator>sc0ttkclark</dc:creator>
			<guid isPermaLink="false">5790@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;All that matters is the front end. Don't escape the HTML in the labels on the front end and I believe 99% of people's needs are filled.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-5789</link>
			<pubDate>Wed, 26 May 2010 12:11:20 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">5789@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@scott the labels are having their HTML escaped because the labels are used in a variety of places, not just the front end.  They are used in numerous places in the admin for display where having HTML within them would cause issues with admin UI display.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sc0ttkclark on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-5754</link>
			<pubDate>Tue, 25 May 2010 10:36:45 +0000</pubDate>
			<dc:creator>sc0ttkclark</dc:creator>
			<guid isPermaLink="false">5754@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;@Carl Hancock, why are labels having their HTML escaped when they are labels and not the value being submitted via $_POST? Remove esc_html from the labels in common.php and you instantly have &#34;HTML&#34; support, keep it in the value fields and all is good.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Kevin Flahaut on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-3431</link>
			<pubDate>Tue, 16 Feb 2010 16:53:54 +0000</pubDate>
			<dc:creator>Kevin Flahaut</dc:creator>
			<guid isPermaLink="false">3431@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The jQuery solution was simply proposed as a bridge until we add this functionality in a future release. Nobody is advocating you use it if you don't like it, it's just another option.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-3423</link>
			<pubDate>Tue, 16 Feb 2010 15:38:43 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">3423@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;We'll look into the subscribe to topics not working.  We use a bbPress plugin for that so we will have to see whats going on.&#60;/p&#62;
&#60;p&#62;We aren't advocating jQuery as the right way to go for everything, however until certain features are added natively to Gravity Forms, sometimes it's the only option until we release updates to Gravity Forms.&#60;/p&#62;
&#60;p&#62;HTML is stripped from checkbox labels right now because until we implement value/label capabilities as a native feature to Gravity Forms, the label is used as the value for the checkbox.&#60;/p&#62;
&#60;p&#62;We do plan on changing this in one of the upcoming releases.&#60;/p&#62;
&#60;p&#62;Just keep in mind that while Gravity Forms is very mature, it is still very new.  We are constantly adding new features and improving things and we still have a laundry list of features that we plan on introducing in the future.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anonymous on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-3419</link>
			<pubDate>Tue, 16 Feb 2010 15:16:19 +0000</pubDate>
			<dc:creator>Anonymous</dc:creator>
			<guid isPermaLink="false">3419@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks.  While I love jQuery for interactive functionality and have done a fair bit of it myself,  I really dislike using it for simple formatting. It breaks when people have Javascript turned off and it causes page loads to be sluggish on slower computers. I'd far, far prefer to do that kind of coding in PHP on the server (where it was meant to be done! :)&#60;/p&#62;
&#60;p&#62;How about another solution?  How about adding a 'gform_field_input' hook to get field input and instead of directly sprint()ing or returning you first pass through said filter?&#60;/p&#62;
&#60;p&#62;BTW, I'm not getting email notifications even though I check &#34;Subscribe to this Topic via Email.&#34;  Are your email notifications not working?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Kevin Flahaut on "Unnecessary esc_html() in get_checkbox_choices()?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-3413</link>
			<pubDate>Mon, 15 Feb 2010 21:21:17 +0000</pubDate>
			<dc:creator>Kevin Flahaut</dc:creator>
			<guid isPermaLink="false">3413@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If you're just looking for &#34;user friendly&#34; text on the front end, you can do this pretty simply with just a few lines of jQuery... even with HTML content. Basically, you use the script to replace the html content of the label client side.  I created a normal checkbox field with 4 options, simply labeled 1-4.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://grab.by/2rFB&#34; rel=&#34;nofollow&#34;&#62;admin screenshot&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I viewed the source and grabbed the unique classes for the labels (actually the parent list item) and replaced the label content based on inheritance from there.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;script type=&#38;quot;text/javascript&#38;quot; src=&#38;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&#38;quot;&#38;gt;&#38;lt;/script&#38;gt;
  &#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;
  $(document).ready(function() {

  $(&#38;#39;li.gchoice_9_1 label&#38;#39;).html(&#38;#39;I like option one because it is &#38;lt;a href=&#38;quot;http://www.yoursite.com/awesome/&#38;quot; target=&#38;quot;_blank&#38;quot;&#38;gt;awesome&#38;lt;/a&#38;gt;.&#38;#39;);
  $(&#38;#39;li.gchoice_9_2 label&#38;#39;).html(&#38;#39;but I might like option two when you think of it&#38;#39;);
  $(&#38;#39;li.gchoice_9_3 label&#38;#39;).html(&#38;#39;option three is looking pretty good though&#38;#39;);
  $(&#38;#39;li.gchoice_9_4 label&#38;#39;).html(&#38;#39;and option four could do the trick&#38;#39;);

  $(&#38;#39;li#field_1_9 .gfield_description&#38;#39;).insertAfter($(&#38;#39;li#field_1_9 .gfield_label&#38;#39;));

  });
 &#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You'll notice that I actually repositioned the &#34;gfield_desciption&#34; div immediately below the main field label as well.&#60;/p&#62;
&#60;p&#62;Note: if you're already loading jQuery in your theme, you can omit the initial script reference.&#60;/p&#62;
&#60;p&#62;here's my &#60;a href=&#34;http://grab.by/2rGk&#34; rel=&#34;nofollow&#34;&#62;sample form screenshot&#60;/a&#62; from the front end, and you'll see that the original value is still passed in the form - &#60;a href=&#34;http://grab.by/2rGu&#34; rel=&#34;nofollow&#34;&#62;admin screenshot&#60;/a&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
