<?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: Cancel a form submit using gform_pre_submission</title>
		<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission</link>
		<description>Gravity Support Forums Topic: Cancel a form submit using gform_pre_submission</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 15:46:56 +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/cancel-a-form-submit-using-gform_pre_submission" rel="self" type="application/rss+xml" />

		<item>
			<title>Alex Cancado on "Cancel a form submit using gform_pre_submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission#post-11747</link>
			<pubDate>Thu, 28 Oct 2010 11:51:07 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">11747@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You do want do use gform_validation. That is the only hook that can stop a form submission.&#60;br /&#62;
You should be able to read the submitted email the same way you do on gform_pre_submission (i.e. $_POST[&#34;input_7&#34;] ).&#60;br /&#62;
The key is to set the &#34;failed_validation&#34; and &#34;validation_message&#34; property of the field to mark it as failed.&#60;br /&#62;
Following is a code snippet to point you in the right direction.&#60;br /&#62;
Good Luck.&#60;br /&#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 a 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>CollegeDegrees on "Cancel a form submit using gform_pre_submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission#post-11726</link>
			<pubDate>Thu, 28 Oct 2010 05:33:24 +0000</pubDate>
			<dc:creator>CollegeDegrees</dc:creator>
			<guid isPermaLink="false">11726@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;On again, off again...  I have messed around with gform_validation and that doesn't seem to be what I want either...  Basically I want to validate an email against an internal scrub list and if the email is there then I want to block the form submit and display a message to the user letting them know I need a different email address.  I can easily grab the field and do the check using gform_pre_submission, but I am not sure of exactly how to do that if it is right at all with gform_validation.&#60;/p&#62;
&#60;p&#62;So in gform_pre_submission I just do the following:&#60;/p&#62;
&#60;p&#62;$email = $_POST[&#34;input_7&#34;];&#60;/p&#62;
&#60;p&#62;and I have the email address to lookup against the scrub list.  I basically tried just wiping $_POST[&#34;input-7&#34;] but it still goes through.  I am guessing that is based upon the sequence that the hooks are called (pre_submission is after validation maybe...).&#60;/p&#62;
&#60;p&#62;Anyway, this seems like it would be a fairly common problem where people would want to validate some piece of information and stop the form submission so I am assuming that as usual I am making this harder than it needs to be.  &#60;/p&#62;
&#60;p&#62;Has anyone else tried anything remotely similar in the past?  Any help would be greatly appreciated.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>CollegeDegrees on "Cancel a form submit using gform_pre_submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission#post-11716</link>
			<pubDate>Wed, 27 Oct 2010 18:03:13 +0000</pubDate>
			<dc:creator>CollegeDegrees</dc:creator>
			<guid isPermaLink="false">11716@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Oh, never mind I got it...  I need to use gform_validation... Okay, will do.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>CollegeDegrees on "Cancel a form submit using gform_pre_submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission#post-11715</link>
			<pubDate>Wed, 27 Oct 2010 17:42:08 +0000</pubDate>
			<dc:creator>CollegeDegrees</dc:creator>
			<guid isPermaLink="false">11715@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I should say that the value I tried wiping is that of a required field.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>CollegeDegrees on "Cancel a form submit using gform_pre_submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/cancel-a-form-submit-using-gform_pre_submission#post-11714</link>
			<pubDate>Wed, 27 Oct 2010 17:34:47 +0000</pubDate>
			<dc:creator>CollegeDegrees</dc:creator>
			<guid isPermaLink="false">11714@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So I have some additional validation that I am doing in the hook gform_pre_submission and would like to know how to make the form cancel.  For instance, I tried wiping out the value of a post field and that did not work.  Is there some easy way to do this?&#60;/p&#62;
&#60;p&#62;Thank you!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
