Location: PHPKode > scripts > Form Builder > form-builder/examples/using_jquery.php
<?
/*Include Form Class*/
include("../class.form.php");

if(!isset($cmd))
	$cmd = "";

if($cmd == "submit")
{
	/*Handles Form Post*/
	echo("<pre>");
	print_r($_POST);
	echo("</pre>");
	exit();
}

if($cmd == "")
{
	?>
	<html>
		<head></head>
		<body>
			<h2 style="text-align: center; margin: 0; padding: 0;">Form Builder Class - Examples</h2>
			<h5 style="text-align: center; margin: 0; padding: 0;"><span style="padding-right: 10px;">Author: Andrew Porterfield</span><span style="padding-right: 10px;">Released: April 24, 2009</span><span>Version: 0.4.0<span></h5>
			<a href="../index.html">Back to Project Home Page</a>
			<p><b>Using jQuery Form Fields</b> - This form class includes two form fields that utilize jQuery - date and sort.  Inside the .zip file, there is a directory titled jquery that contains all the essential files and images for these fields.  This directory needs to be installed in a public path on a web server. Use the jqueryPath paramenter to tie the location of your application file to the jquery directory.  NOTE: If your application file (the file where you are building the form) is in the same directory as the class.form.php file, you will not need to set this parameter as the default value will be correctly assigned. 
			In this php file, you will see that the jqueryPath parameter is set to "../jquery", which accounts for the "examples" directory that this file is sitting in.  The jQuery documentation can be found on <a href="http://www.jqueryui.com" target="blank">http://www.jqueryui.com</a>.</p>
			<?

			$form = new form();
			$form->setAttributes(array(
				"jqueryPath" => "../jquery",
				"tableAttributes" => array("width" => "300")
			));

			$form->addHidden("cmd", "submit");
			$form->addDate("Your Birthday:", "field0");
			$form->addDate("Today's Date Pre-filled:", "field1", date("F j, Y"));
			$form->addSort("Sort Your Favorite Baseball Teams:", "field2", array("Dodgers" => "Dodgers", "Cubs" => "Cubs", "Cardinals" => "Cardinals"));
			$form->addSort("Sort These Items Alphabetically:", "field3", array("goat" => "Goat", "cat" => "Cat", "dog" => "Dog"));
			//----------------------------------------------------------------------------------

			//Add Submit Button
			$form->addButton();

			//Render Form HTML
			$form->render();
			?>
			<a href="../index.html">Back to Project Home Page</a>
		</body>
	</html>	
	<?
}
?>

Return current item: Form Builder