<?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: Number Format Mask</title>
		<link>https://legacy.forums.gravityhelp.com/topic/number-format-mask</link>
		<description>Gravity Support Forums Topic: Number Format Mask</description>
		<language>en-US</language>
		<pubDate>Fri, 17 Apr 2026 17:55:00 +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/number-format-mask" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "Number Format Mask"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/number-format-mask#post-17046</link>
			<pubDate>Wed, 26 Jan 2011 18:03:44 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">17046@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Assuming that your &#60;strong&#62;isValidSSN()&#60;/strong&#62; function works, here is some updated code that will require a little less code to do the same thing:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastie.org/1500617&#34; rel=&#34;nofollow&#34;&#62;http://pastie.org/1500617&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;There is one catch though... instead of specify the ID of each field and each form in the code, you'll need to add a classs (via the GF form admin) to each field that should be validated as a SSN. You'll see what I mean when you check out the code. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thehorse on "Number Format Mask"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/number-format-mask#post-17017</link>
			<pubDate>Tue, 25 Jan 2011 19:17:28 +0000</pubDate>
			<dc:creator>thehorse</dc:creator>
			<guid isPermaLink="false">17017@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am trying to validate that a number is a social security number.&#60;/p&#62;
&#60;p&#62;Can REGEX expressions be used in a number field, much like the built-in phone number field works?  Or better yet- a built-in SSN field that validates a) 9 digit number in the format of 3-2-4 and b) that it is actually a VALID 9 digit SSN (a la &#60;a href=&#34;http://www.ssa.gov/employer/highgroup.txt&#34; rel=&#34;nofollow&#34;&#62;http://www.ssa.gov/employer/highgroup.txt&#60;/a&#62; and jrez.com's function that validates the SSN usinga GNU function)&#60;br /&#62;
//.&#60;/p&#62;
&#60;p&#62;I have started to build a validated function for this, but I find that I am using the field so often on so many forms, it is becoming cumbersome customizing for which field that function fires&#60;/p&#62;
&#60;p&#62;Here is my function, but it was starting to get out of control&#34;&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;//add_filter(&#38;#39;gform_validation&#38;#39;, &#38;#39;valid_ssn&#38;#39;);
function valid_ssn($validation_result){
    $form = $validation_result[&#38;quot;form&#38;quot;];
    // if not form ID 2, return result unmodified
    if($form[&#38;quot;id&#38;quot;] != 2)
        return $validation_result;

    if (isset($_POST[&#38;#39;input_3&#38;#39;])){
      if (  !isValidSSN($_POST[&#38;#39;input_3&#38;#39;])){
        // 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;][2][&#38;quot;failed_validation&#38;quot;] = true;
        $form[&#38;quot;fields&#38;quot;][2][&#38;quot;validation_message&#38;quot;] = &#38;quot;This is an invalid Social Security Number. Please check.&#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;

      }else {
        $validation_result[&#38;quot;is_valid&#38;quot;] = true;
        $form = $validation_result[&#38;quot;form&#38;quot;];
        //return $validation_result;
      }
    }&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
