<?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: Validate Input</title>
		<link>https://legacy.forums.gravityhelp.com/topic/validate-input</link>
		<description>Gravity Support Forums Topic: Validate Input</description>
		<language>en-US</language>
		<pubDate>Thu, 23 Apr 2026 19:37:03 +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/validate-input" rel="self" type="application/rss+xml" />

		<item>
			<title>Carl Hancock on "Validate Input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/validate-input#post-19115</link>
			<pubDate>Mon, 21 Feb 2011 17:39:32 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">19115@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Good to hear! The hooks are really powerful and let you do all sorts of things with Gravity Forms.  Full documentation on the hooks will be launching with the final release of Gravity Forms v1.5 which we are targeting for next week.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>shadowedsoul on "Validate Input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/validate-input#post-19114</link>
			<pubDate>Mon, 21 Feb 2011 17:32:34 +0000</pubDate>
			<dc:creator>shadowedsoul</dc:creator>
			<guid isPermaLink="false">19114@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I was able to get it going pretty easily with the following code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_validation&#38;#39;, &#38;#39;custom_validation&#38;#39;);
function custom_validation($validation_result){
	$pattern = &#38;#39;&#124;^http(s)?://us.battle.net/wow/en/character/[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$&#124;i&#38;#39;;
	// set the form validation to false
    $form = $validation_result[&#38;quot;form&#38;quot;];
    print_r($form[&#38;quot;fields&#38;quot;][21]);
	if(preg_match($pattern, $_POST[&#38;#39;input_21&#38;#39;]) == false) {
		$validation_result[&#38;quot;is_valid&#38;quot;] = false;
		$form[&#38;quot;fields&#38;quot;][21][&#38;quot;failed_validation&#38;quot;] = true;
		$form[&#38;quot;fields&#38;quot;][21][&#38;quot;validation_message&#38;quot;] = &#38;quot;&#38;lt;strong&#38;gt;Armory Link: &#38;lt;/strong&#38;gt;You must provide a valid URL, it should contain http:// at the beginning, and it should be a link to the armory!&#38;quot;;
	}
	if(preg_match($pattern, $_POST[&#38;#39;input_22&#38;#39;]) == false &#38;amp;&#38;amp; $_POST[&#38;#39;input_22&#38;#39;] != &#38;quot;&#38;quot;) {
		$validation_result[&#38;quot;is_valid&#38;quot;] = false;
		$form[&#38;quot;fields&#38;quot;][22][&#38;quot;failed_validation&#38;quot;] = true;
		$form[&#38;quot;fields&#38;quot;][22][&#38;quot;validation_message&#38;quot;] = &#38;quot;&#38;lt;strong&#38;gt;Raid Parse: &#38;lt;/strong&#38;gt;You must provide a valid URL, it should contain http:// at the beginning.&#38;quot;;
	}

    // update the form in the validation result with the form object you modified
    $validation_result[&#38;quot;form&#38;quot;] = $form;

    return $validation_result;

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks for the help!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Validate Input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/validate-input#post-19090</link>
			<pubDate>Mon, 21 Feb 2011 15:28:29 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">19090@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;There is a validation hook you can use to write custom validation for a field (or fields).  The hook is the gform_validation field.  &#60;/p&#62;
&#60;p&#62;Here is an example of the gform_validation field in action.  This doesn't do what you want to do, it's simply an example of using the gform_validation field to implement custom validation.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;#39;gform_validation&#38;#39;, &#38;#39;custom_validation&#38;#39;);
function custom_validation($validation_result){

    // set the form validation to false
    $validation_result[&#38;quot;is_valid&#38;quot;] = false;
    $form = $validation_result[&#38;quot;form&#38;quot;];

    // specify the first field to be invalid and provide custom validation message
    $form[&#38;quot;fields&#38;quot;][0][&#38;quot;failed_validation&#38;quot;] = true;
    $form[&#38;quot;fields&#38;quot;][0][&#38;quot;validation_message&#38;quot;] = &#38;quot;This field is invalid!&#38;quot;;

    // update the form in the validation result with the form object you modified
    $validation_result[&#38;quot;form&#38;quot;] = $form;

    return $validation_result;

}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>shadowedsoul on "Validate Input"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/validate-input#post-19083</link>
			<pubDate>Mon, 21 Feb 2011 14:00:21 +0000</pubDate>
			<dc:creator>shadowedsoul</dc:creator>
			<guid isPermaLink="false">19083@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;On my form at: &#60;a href=&#34;http://dev.shadowedsoul.net/recruitment-application/&#34; rel=&#34;nofollow&#34;&#62;http://dev.shadowedsoul.net/recruitment-application/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I'm looking to validate the two fields that the users can enter a web address into.  I'm comfortable on the php side of things and regular expressions but I'm completely missing where I hook into this functionality and don't see a decent example.&#60;/p&#62;
&#60;p&#62;Any help available on this front?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
