Location: PHPKode > scripts > Formcat Class > formcat-class/pro/plugins/block.catform.php
<?php
/**
 * Project: Formcat, form client-side validate class.
 * 
 * (c) 2004-2005 Justto.com Propagator Team
 * Author: Joey Wong [hide@address.com][MSN:hide@address.com]
 * Website: http://formcat.justto.com
 * Released under both BSD and GNU Lesser GPL library license. 
 * This means you can use it in proprietary products.
 *
 * For questions, help, comments, discussion, etc.,please contact
 * hide@address.com
 * 
 * The latest version of Formcat can be obtained from:
 * http://formcat.justto.com/ or http://formcat.joey.cn
 *
 * @link http://www.propagator.net/formcat/
 * @copyright 2004,2005 Joey Wong.
 * @author Joey <hide@address.com> [msn:hide@address.com
 * @version: 1.04
 **/
 
 /*
 * Smarty plugin  
 * -------------------------------------------------------------
 * Type:     block
 * Name:     catform
 * Purpose:  calculate the multi-form and place the onSubmit string.
 * -------------------------------------------------------------
 */
 
function smarty_block_catform($params, $content, &$smarty){

	//set the current form
	$form_name = (isset($params['form']))?$params['form']:$params['FORM'];
    $GLOBALS['_currentForm'] = $form_name;
   
  	//Store the form name list to session if form html tags are exist.
    if(preg_match('/<(form|FORM|Form)[^>]*>/', $content, $regs)){
	    
	    if(is_array($_SESSION['catformList'])){
	    	if(!in_array($form_name,$_SESSION['catformList'])){
	    	
	    		array_push($_SESSION['catformList'],$form_name);
	    	}
	    }else{
	    	$_SESSION['catformList'] = array($form_name);
		}
	
		//Add OnSubmit event to <form> tags.
		$formTags = $regs[0];
		$replaceTags = rtrim($formTags,">")." onSubmit='return pigcatFCValidate_".$form_name."(this);'>";   
    	$content = str_replace($formTags,$replaceTags,$content);
   	
	}
	
	//Form public extra function	
	$_SESSION['catformParams_'.$form_name] = $params;
   
   	//Return result
	echo $content;
	return;

}
?>
Return current item: Formcat Class