RSFORM PRO VALIDAÇÃO

  • gebece
  • Avatar de gebece Autor do Tópico
  • Offline
  • JCB! Novato
  • JCB! Novato
Mais
14 anos 9 meses atrás #8660 por gebece
gebece created the topic: RSFORM PRO VALIDAÇÃO
Olá, gostaria de saber se alguem pode me ajudar.

Tanho instalado um rsform, com o plugin mappings.

Eu tenho um formulario onde o cliente tem que digitar o cnpj da empresa.

Mas gostaria de validar o cnpj da seguinte maneira:

Ele faz uma consulta nos submissions já existentes..se o cnpj já consta lá ele da uma mensagem dizendo que o cnpj ja existe...nao sei se faço isso por submit...nao tenho ideia...alguem tem ideia de como fazer isso?

Outra coisa menos importante eh colocar uma mascara no cnpj...

Obrigado!

Please Entrar ou Registrar to join the conversation.


Mais
13 anos 4 meses atrás #41461 por levibsb
levibsb replied the topic: Re: RSFORM PRO VALIDAÇÃO
Ola cara, onde vc baixou o Rsforms?
Teria como vc disponibilizar aqui no forum para dowloads

Please Entrar ou Registrar to join the conversation.

Mais
12 anos 1 semana atrás #66525 por michellhornung
michellhornung replied the topic: Re: RSFORM PRO VALIDAÇÃO
Olá!
Estou precisando fazer a validação com máscara de entrada em alguns campos como CPF, CNPJ... Utilizando o rsform pro.

Tópico antigo, mas alguém conseguiu???

Valeu.

Please Entrar ou Registrar to join the conversation.

Mais
11 anos 8 meses atrás #74847 por badtenvo
badtenvo replied the topic: Re: RSFORM PRO VALIDAÇÃO
Alguem??

[i:3um02383][b:3um02383]Os Mais Belos Site do Brasil http:///www.vika33.com.br. Confira, produtos excelentes e otimos preços![/b:3um02383][/i:3um02383]

Please Entrar ou Registrar to join the conversation.

Mais
11 anos 7 meses atrás #77151 por rmachado18
rmachado18 replied the topic: Re: RSFORM PRO VALIDAÇÃO
Pessoal estou com a dificuldade parecida, contudo, gostaria de ajustar os campos de validação para os padrões aqui no Brasil, não manjo muito disso e meu programador está de férias <!-- s:( --><img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Triste" /><!-- s:( --> , alguém poderia me ajudar?

Preciso ajustar as validações pra puxar as mascaras no formulário.

O arquivo do código de validação está em /components/com_rsform/helpers/validation.php

Encontrei esse link com as validações:http://forum.imasters.com.br/topic/222133-mascara-e-validacao-de-cpfcnpjcepdatatelefone/

Estou tentando aqui! se conseguir anexo o código para todos.

Abraço

Código Original
<?php

/**

* @version 1.4.0

* @package RSform!Pro 1.4.0

* @copyright (C) 2007-2011 www.rsjoomla.com

* @license GPL, http://www.gnu.org/copyleft/gpl.html

*/



// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );



class RSFormProValidations

{

	function none($value,$extra=null,$data=null)

	{

		return true;

	}



	function alpha($param,$extra=null,$data=null)

	{

		if(strpos($param,"\n") !== false) 

			$param = str_replace(array("\r","\n"),'',$param);

			

		for($i=0;$i<strlen($param);$i++)

			if(strpos($extra,$param&#91;$i&#93;) === false && preg_match('#(&#91;^a-zA-Z &#93;)#', $param&#91;$i&#93;))

				return false;

				

		return true;

	}

	

	function numeric($param,$extra=null,$data=null)

	{

		if(strpos($param,"\n") !== false) 

			$param = str_replace(array("\r","\n"),'',$param);

		

		for($i=0;$i<strlen($param);$i++)

			if (strpos($extra,$param&#91;$i&#93;) === false && !is_numeric($param&#91;$i&#93;))

				return false;

				

		return true;

	}

	

	function alphanumeric($param,$extra = null,$data=null)

	{

		if(strpos($param,"\n") !== false) 

			$param = str_replace(array("\r","\n"),'',$param);

		

		for($i=0;$i<strlen($param);$i++)

			if(strpos($extra,$param&#91;$i&#93;) === false && preg_match('#(&#91;^a-zA-Z0-9 &#93;)#', $param&#91;$i&#93;))

				return false;

				

		return true;

	}

	

	function email($email,$extra=null,$data=null)

	{

		jimport('joomla.mail.helper');

		

		$email = trim($email);

		return JMailHelper::isEmailAddress($email);

	}

	

	function emaildns($email,$extra=null,$data=null)

	{

		// Check if it's an email address format

		if (!RSFormProValidations::email($email,$extra,$data))

			return false;

		

		$email = trim($email);

		list($user, $domain) = explode('@', $email, 2);

		

		// checkdnsrr for PHP < 5.3.0

		if (!function_exists('checkdnsrr') && function_exists('exec') && is_callable('exec'))

		{

			@exec('nslookup -type=MX '.escapeshellcmd($domain), $output);

			foreach($output as $line)

				if (preg_match('/^'.preg_quote($domain).'/',$line))

					return true;

			

			return false;

		}

		

		// fallback method...

		if (!function_exists('checkdnsrr') || !is_callable('checkdnsrr'))

			return true;

		

		return checkdnsrr($domain, substr(PHP_OS, 0, 3) == 'WIN' ? 'A' : 'MX');

	}

	

	function uniquefield($value, $extra=null,$data=null)

	{

		$db 	=& JFactory::getDBO();

		$form   = JRequest::getVar('form');

		$formId = (int) @$form&#91;'formId'&#93;;

		

		$db->setQuery("SELECT `SubmissionValueId` FROM #__rsform_submission_values WHERE FormId='".$formId."' AND `FieldName`='".$db->getEscaped($data&#91;'NAME'&#93;)."' AND `FieldValue`='".$db->getEscaped($value)."'");

		return $db->loadResult() ? false : true;

	}

	

	function uniquefielduser($value, $extra=null,$data=null)

	{

		$db 	=& JFactory::getDBO();

		$form   = JRequest::getVar('form');

		$formId = (int) @$form&#91;'formId'&#93;;

		$user	=& JFactory::getUser();

		

		$db->setQuery("SELECT sv.`SubmissionValueId` FROM #__rsform_submission_values sv LEFT JOIN #__rsform_submissions s ON (sv.SubmissionId=s.SubmissionId) WHERE sv.FormId='".$formId."' AND sv.`FieldName`='".$db->getEscaped($data&#91;'NAME'&#93;)."' AND sv.`FieldValue`='".$db->getEscaped($value)."' AND (".($user->get('guest') ? "s.`UserIp`='".$db->getEscaped($_SERVER&#91;'REMOTE_ADDR'&#93;)."'" : "s.`UserId`='".(int) $user->get('id')."'").")");

		return $db->loadResult() ? false : true;

	}

	

	function uszipcode($value)

	{

		 return preg_match("/^(&#91;0-9&#93;{5})(-&#91;0-9&#93;{3})?$/i",$value); 





	}







	

	function phonenumber($value)

	{

		return preg_match("/\(?\b&#91;0-9&#93;{2}\)?&#91;-. &#93;?&#91;0-9&#93;{4}&#91;-. &#93;?&#91;0-9&#93;{4}\b/i", $value);

	}

	













	function creditcard($value,$extra=null,$data=null)

	{

		$value = preg_replace ('/&#91;^0-9&#93;+/', '', $value);

		if (!$value)

			return false;

		

		if (preg_match("/^(&#91;34|37&#93;{2})(&#91;0-9&#93;{13})$/", $value)) // Amex

			return true;

		

		if (preg_match("/^(&#91;30|36|38&#93;{2})(&#91;0-9&#93;{12})$/", $value)) // Diners

			return true;

		

		if (preg_match("/^(&#91;6011&#93;{4})(&#91;0-9&#93;{12})$/", $value)) // Discover

			return true;

			

		if (preg_match("/^(&#91;51|52|53|54|55&#93;{2})(&#91;0-9&#93;{14})$/", $value)) // Master

			return true;

			

		if (preg_match("/^(&#91;4&#93;{1})(&#91;0-9&#93;{12,15})$/", $value)) // Visa

			return true;

		

		return false;

	}



	function custom($param,$extra=null,$data=null)

	{

		if(strpos($param,"\n") !== FALSE) 

			$param = str_replace(array("\r","\n"),'',$param);

		

		for($i=0;$i<strlen($param);$i++)

			if(strpos($extra,$param&#91;$i&#93;) === false)

				return false;

				

		return true;

	}



	function password($param,$extra=null,$data=null)

	{

		if ($data&#91;'DEFAULTVALUE'&#93; == $param)

			return true;

		

		return false;

	}

	

	function ipaddress($param,$extra=null,$data=null)

	{

		return preg_match('#\b(25&#91;0-5&#93;|2&#91;0-4&#93;&#91;0-9&#93;|&#91;01&#93;?&#91;0-9&#93;&#91;0-9&#93;?)\.(25&#91;0-5&#93;|2&#91;0-4&#93;&#91;0-9&#93;|&#91;01&#93;?&#91;0-9&#93;&#91;0-9&#93;?)\.(25&#91;0-5&#93;|2&#91;0-4&#93;&#91;0-9&#93;|&#91;01&#93;?&#91;0-9&#93;&#91;0-9&#93;?)\.(25&#91;0-5&#93;|2&#91;0-4&#93;&#91;0-9&#93;|&#91;01&#93;?&#91;0-9&#93;&#91;0-9&#93;?)\b#', $param, $match);

	}

	

	function validurl($param,$extra=null,$data=null)

	{

		$format = 

		'/^(https?):\/\/'.                                         // protocol

		'((&#91;a-z0-9$_\.\+!\*\'\(\),;\?&=-&#93;|%&#91;0-9a-f&#93;{2})+'.         // username

		'(:(&#91;a-z0-9$_\.\+!\*\'\(\),;\?&=-&#93;|%&#91;0-9a-f&#93;{2})+)?'.      // password

		'@)?(?#'.                                                  // auth requires @

		')(((&#91;a-z0-9&#93;&#91;a-z0-9-&#93;*&#91;a-z0-9&#93;\.)*'.                      // domain segments AND

		'&#91;a-z&#93;&#91;a-z0-9-&#93;*&#91;a-z0-9&#93;'.                                 // top level domain  OR

		'|((\d|&#91;1-9&#93;\d|1\d{2}|2&#91;0-4&#93;&#91;0-9&#93;|25&#91;0-5&#93;)\.){3}'.

		'(\d|&#91;1-9&#93;\d|1\d{2}|2&#91;0-4&#93;&#91;0-9&#93;|25&#91;0-5&#93;)'.                 // IP address

		')(:\d+)?'.                                                // port

		')(((\/+(&#91;a-z0-9$_\.\+!\*\'\(\),;:@&=-&#93;|%&#91;0-9a-f&#93;{2})*)*'. // path

		'(\?(&#91;a-z0-9$_\.\+!\*\'\(\),;:@&=-&#93;|%&#91;0-9a-f&#93;{2})*)'.      // query string

		'?)?)?'.                                                   // path and query string optional

		'(#(&#91;a-z0-9$_\.\+!\*\'\(\),;:@&=-&#93;|%&#91;0-9a-f&#93;{2})*)?'.      // fragment

		'$/i';

		

		return preg_match($format, $param, $match);

	}

	

	function regex($value,$pattern=null,$data=null)

	{

		return preg_match($pattern, $value);

	}

}

?>

[center:3h2z53bp]"A persistência é o caminho do êxito."
[b:3h2z53bp]Charles Chaplin[/b:3h2z53bp]

[url:3h2z53bp]http://www.atendemtecnologia.com.br[/url:3h2z53bp][/center:3h2z53bp]

Please Entrar ou Registrar to join the conversation.