<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: Changing phone number validation</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Changing phone number validation</description>
<language>en</language>
<pubDate>Mon, 04 May 2026 01:27:20 +0000</pubDate>

<item>
<title>yuniar on "Changing phone number validation"</title>
<link>https://www.machform.com/forums/topic/changing-phone-number-validation#post-1617</link>
<pubDate>Sat, 03 May 2008 08:06:11 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">1617@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;The easiest way to allow &#34;-&#34; character would be this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function validate_simple_phone($value){

	$error_message = VAL_PHONE;

	if($value[0]{0} == &#38;#39;+&#38;#39;){
		$test_value = substr($value[0],1);
	}else{
		$test_value = $value[0];
	}
	$test_value = str_replace(array(&#38;quot; &#38;quot;,&#38;quot;-&#38;quot;),&#38;quot;&#38;quot;,$test_value);
	if(is_numeric($test_value) &#38;#38;&#38;#38; (strlen($test_value) &#38;gt; 3)){
		return true;
	}else{
		return $error_message;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>philwareham on "Changing phone number validation"</title>
<link>https://www.machform.com/forums/topic/changing-phone-number-validation#post-1610</link>
<pubDate>Fri, 02 May 2008 16:00:09 +0000</pubDate>
<dc:creator>philwareham</dc:creator>
<guid isPermaLink="false">1610@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;That's great, thanks yuniar.&#60;br /&#62;
Can I scrounge one more thing... is there any chance you could supply the above example but also including support for &#34;-&#34; character in the phone number?&#60;br /&#62;
Thanks a lot,&#60;br /&#62;
Phil
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Changing phone number validation"</title>
<link>https://www.machform.com/forums/topic/changing-phone-number-validation#post-1600</link>
<pubDate>Fri, 02 May 2008 07:41:28 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">1600@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;The 'international' phone format accept +XXXXXXX or XXXXXX numbers.&#60;br /&#62;
The minimum length is 3 numbers and spaces are not allowed.&#60;/p&#62;
&#60;p&#62;If you would like to allow spaces, edit your includes/common-validator.php file.&#60;br /&#62;
Search around line 145 for this code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function validate_simple_phone($value){

	$error_message = VAL_PHONE;

	if($value[0]{0} == &#38;#39;+&#38;#39;){
		$test_value = substr($value[0],1);
	}else{
		$test_value = $value[0];
	}

	if(is_numeric($test_value) &#38;#38;&#38;#38; (strlen($test_value) &#38;gt; 3)){
		return true;
	}else{
		return $error_message;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
replace it with this one:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function validate_simple_phone($value){

	$error_message = VAL_PHONE;

	if($value[0]{0} == &#38;#39;+&#38;#39;){
		$test_value = substr($value[0],1);
	}else{
		$test_value = $value[0];
	}
	$test_value = str_replace(&#38;quot; &#38;quot;,&#38;quot;&#38;quot;,$test_value);
	if(is_numeric($test_value) &#38;#38;&#38;#38; (strlen($test_value) &#38;gt; 3)){
		return true;
	}else{
		return $error_message;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
that should allow spaces.
&#60;/p&#62;</description>
</item>
<item>
<title>philwareham on "Changing phone number validation"</title>
<link>https://www.machform.com/forums/topic/changing-phone-number-validation#post-1588</link>
<pubDate>Thu, 01 May 2008 16:39:52 +0000</pubDate>
<dc:creator>philwareham</dc:creator>
<guid isPermaLink="false">1588@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi there,&#60;br /&#62;
I wish to use the 'phone' field in a form on a UK-centric website, where there are numerous ways people can enter their phone number (for instance some numbers are ##### ###### whilst others are #### ### ##### etc). Having set the field option to 'international' I'm still getting an error message on submit to enter a valid phone number.&#60;br /&#62;
Is there any way of manually adjusting the code to accommodate this? I would use the simple 'numbers' field but that does not seem to like the use of spaces.&#60;br /&#62;
Thanks,&#60;br /&#62;
Phil
&#60;/p&#62;</description>
</item>

</channel>
</rss>
