<?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: Ensure &#039;Required&#039; box is ticked by default</title>
		<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default</link>
		<description>Gravity Support Forums Topic: Ensure &#039;Required&#039; box is ticked by default</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 10:11:21 +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/ensure-required-box-is-ticked-by-default" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Ensure &#039;Required&#039; box is ticked by default"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default#post-35416</link>
			<pubDate>Thu, 15 Sep 2011 15:30:43 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">35416@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Alex provided the following code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;set_required&#38;quot;);
add_filter(&#38;quot;gform_validation&#38;quot;, &#38;quot;check_required&#38;quot;);

function set_required($form){
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        $field[&#38;quot;isRequired&#38;quot;] = true;

    return $form;
}

function check_required($validation_result){
    foreach($validation_result[&#38;quot;form&#38;quot;][&#38;quot;fields&#38;quot;] as &#38;amp;$field){

        if(GFFormDisplay::is_empty($field, $validation_result[&#38;quot;form&#38;quot;][&#38;quot;id&#38;quot;])){
            $field[&#38;quot;failed_validation&#38;quot;] = true;
            $field[&#38;quot;validation_message&#38;quot;] = &#38;quot;This field is required.&#38;quot;;
            $validation_result[&#38;quot;is_valid&#38;quot;] = false;
        }
    }
    return $validation_result;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;One side effect of doing it this way is that the form builder will NOT show that fields are required (because they're not at that point.)  They are made required when the form is displayed to a visitor.&#60;/p&#62;
&#60;p&#62;There are two functions, two filters there.  The set_required function will make each field required before the form is rendered.  The check_required handles the validation upon submit.&#60;/p&#62;
&#60;p&#62;Let me know if you need any assistance implementing this.  This code will be added to your functions.php file in your current theme.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Ensure &#039;Required&#039; box is ticked by default"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default#post-35410</link>
			<pubDate>Thu, 15 Sep 2011 13:14:38 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">35410@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am checking with the developers to see if there is a filter you can use to make this happen.  I'll post when I find out.  Thanks for your patience.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mark on "Ensure &#039;Required&#039; box is ticked by default"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default#post-35382</link>
			<pubDate>Thu, 15 Sep 2011 04:54:18 +0000</pubDate>
			<dc:creator>Mark</dc:creator>
			<guid isPermaLink="false">35382@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Correct! All added fields should be 'required' as default.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Ensure &#039;Required&#039; box is ticked by default"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default#post-35287</link>
			<pubDate>Wed, 14 Sep 2011 13:11:34 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">35287@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Rather than having to mark each field required when creating a new form, you want the default to be required for all fields you add.  Is that correct?    That way the default for a form would be &#60;strong&#62;all&#60;/strong&#62; fields required rather than &#60;strong&#62;no&#60;/strong&#62; fields required.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mark on "Ensure &#039;Required&#039; box is ticked by default"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/ensure-required-box-is-ticked-by-default#post-35235</link>
			<pubDate>Wed, 14 Sep 2011 06:35:06 +0000</pubDate>
			<dc:creator>Mark</dc:creator>
			<guid isPermaLink="false">35235@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi there&#60;/p&#62;
&#60;p&#62;I'd like to ensure ALL fields when added to forms are required. Tried adding a  'checked=&#34;yes&#34;' to the input type declaration but didn't seem to do it.&#60;/p&#62;
&#60;p&#62;Any ideas?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
