<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>--:.formAt.:--</title>
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:active {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
color: #999999;
font-size: 12px;
}
.fieldStyle {
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
color:#999999;
border:solid 1px #CCCCCC;
width:200px
}
.radioCheckStyle {
font-family: Arial, Helvetica, sans-serif;
font-size:14px;
color:#999999;
width:200px
}
.style2 {
color: #FFFFFF;
font-size: 18px;
}
.style4 {font-size: 24px}
.style5 {color: #000066}
-->
</style>
</head>
<body>
<p align="center"><a href="index.html"><img src="logo.gif" width="335" height="67" border="0" /></a></p>
<?
include("config.php");
// INCLUDE CLASS
include("formAt.class.php");
// DECLARE AND INITIALIZE OBJECT
mysql_connect($host,$login,$password);
mysql_select_db($database);
$formAt = new formAt(false); // I won't be connected by the object
$formAt->defaults(false); // don't get the database default values
if(isset($_GET["debug"])){
$formAt->startDebug();
}
?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="78%" valign="top"><form id="formAt" name="formAt" method="post" action="">
<table width="529" border="0" align="center" cellpadding="2" cellspacing="2" style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#999999">
<tr>
<td colspan="2" align="right" valign="top" bgcolor="#B4B4B4"><span class="style2"><a href="basicUsage.php" style="color:#333333">.Basic Usage</a> |<span class="style4"> .Advanced Usage</span> </span></td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td>
<?
if(isset($_GET["debug"])){
echo '<a href="'.$_SERVER['PHP_SELF'].'" style="color:red;font-weight:bold">[ STOP DEBUG ]</a>';
}
else{
echo '<a href="'.$_SERVER['PHP_SELF'].'?debug=1" style="color:red;font-weight:bold">[ DEBUG FORM ]</a>';
} ?>
</td>
</tr>
<tr>
<td width="199" align="right" valign="top">Customer Name </td>
<td width="316">
<?
// Generate textfield
echo $formAt->genStrField("car_rental", // table
"customer_name", // column
"my Value", // default value
"fieldStyle", // css style
"text", // type
'onChange="alert(this.name+\' field value has changed\')"', // added javascript code
"customer" // forced field name
);
?>
<br />
<div align="left">
<pre style="font-size:9px">//Generate textfield<br />echo $formAt->genStrField(
"car_rental", // table<br /> "customer_name", // column<br /> "my Value", // default value <br /> "fieldStyle", // css style<br /> "text", // type<br /> 'onChange="alert(this.name+\' field value has changed\')"',<br /> "customer"// forced field name<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Rent Mode </td>
<td bgcolor="#EAEAEA"><?
// Generate radio set from enum colum
echo $formAt->genEnumSetField("car_rental", // table
"rent_mode", // colum
"radioCheckStyle", // css style
"select", // object type
array("daily"), // default value
'onChange="alert(\'Clicked \'+this.value)"' // added javascript
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Generate radio-set from enum column <br />echo $formAt->genEnumSetField(<br /> "car_rental", //table<br /> "rent_mode", // column<br /> "radioCheckStyle", // css style<br /> "select", // object type<br /> array("daily"), // default value <br /> 'onChange="alert(\'Clicked \'+this.value)"'<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top">Credit Card </td>
<td><?
// Generate checkbos set from set colum
echo $formAt->genEnumSetField("car_rental", // table
"credit_card", // colum
"radioCheckStyle", // css style
"select", // object type
array("visa","master card"), // values
'style="font-size:18px"', // added css style code
2, // select size
true, // select-multiple
"card" // forced name
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Generate checkbox-set from set column <br />echo $formAt->genEnumSetField(<br /> "car_rental", // table<br /> "credit_card", // column<br /> "radioCheckStyle",// css style<br /> "select", // object type<br /> array("visa","master card"), // values<br /> 'style="font-size:18px"', // added css style code<br /> 2, // select size<br /> true, // select-multiple<br /> "card" //forced name<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Service Description </td>
<td bgcolor="#EAEAEA"><?
// Generate textarea
echo $formAt->genStrField("car_rental", // table
"service_description", // column
"I need a ...", // default value
"fieldStyle" // css style
);
?>
<br />
<div align="left">
<pre style="font-size:9px">// Generate textarea<br />echo $formAt->genStrField(<br /> "car_rental", //table<br /> "service_description", // column<br /> "I need a ...", // default value <br /> "fieldStyle" // css style<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top">Price</td>
<td><?
// Generate textfield
echo $formAt->genStrField("car_rental", // table
"price", // column
"200.00", // default value
"fieldStyle" , // css style
"text", // type
'style="color:red"', // added javascript code
"price" // forced field name
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Generate textfield<br />echo $formAt->genStrField(<br /> "car_rental", // table<br /> "price", // column<br /> "200.00", // default value <br /> "fieldStyle", // css style<br /> "text", // type<br /> 'style="color:red"', //added style code<br /> "price" // forced field name<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Pick-up Time </td>
<td bgcolor="#EAEAEA"><?
// Generate textfield
echo $formAt->genStrField("car_rental", // table
"pickup_time", // column
"", // default value
"fieldStyle" // css style
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Generate textfield <br />echo $formAt->genStrField(
"car_rental", //table<br /> "pickup_time", // column<br /> "", // default value <br /> "fieldStyle" //css style<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top">Drop-off Time </td>
<td><?
// Generate textfield
echo $formAt->genStrField("car_rental", // table
"dropoff_time", // column
"", // default value
"fieldStyle" // css style
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Generate textfield <br />echo $formAt->genStrField(
"car_rental", // table<br /> "dropoff_time", // column<br /> "", // default value <br /> "fieldStyle" // css style<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Car</td>
<td bgcolor="#EAEAEA"><?
// Generate a select object based on a table
$formAt->setSelectIniLabel("Select a Car"); // Set the first option label for information
echo $formAt->genCatalogueField("cars", // table
"car_id", // column for value
"car", // column for label
"fieldStyle" , // css style
"checkbox", // set to checkbox-set
'WHERE car_id<4', // sql extra code
array(1,3), // selected values
'onClick="alert(\'onClick event\')"' // javascript code
);
?>
<br />
<div align="left">
<pre style="font-size:9px">// Generate a select object based on a table<br />$formAt->setSelectIniLabel("Select a Car"); // Set the first option<br />echo $formAt->genCatalogueField(<br /> "cars", //table<br /> "car_id", // column for value<br /> "car", // column for label<br /> "fieldStyle", // css style<br /> "checkbox", // set to checkbox-set<br /> 'WHERE car_id<4', // sql extra code<br /> array(1,3), // selected values '<br /> 'onClick="alert(\'onClick event\')' // javascript code<br />);</pre>
</div></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top" bgcolor="#FFFFCC"><span class="style5">STANDALONE FIELDS</span> <br />
(Not related to database)</td>
</tr>
<tr>
<td align="right" valign="top">Field A </td>
<td>
<?
// StandAlone password field
echo $formAt->addTHPInput("Field_A", // Field Name
"abcd123", // Value
"password", // type
"fieldStyle", // css style
30, // maxlength
'onChange="alert(\'The password is: \'+this.value)"' // javascript
);
?> <br />
<div align="left">
<pre style="font-size:9px">// StandAlone password field<br />echo $formAt->addTHPInput(
"Field_A", // Field Name<br /> "abcd123", // Value<br /> "password", // type<br /> "fieldStyle", // css style<br /> 30, // maxlength<br /> 'onChange="alert(\'The password is: \'+this.value)"' // javascript<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Field B </td>
<td bgcolor="#EAEAEA">
<?
// Standalone select field
// Labels an Values
$fieldBData = array(
array("label"=>"b1","value"=>"1"),
array("label"=>"b2","value"=>"2"),
array("label"=>"b3","value"=>"3")
);
echo $formAt->addSelectList("Field_B", // Name
$fieldBData, // Data
"fieldStyle", // Css Style
array(1,3), // Selected
'style="background-color:#ccc"', // Added style
3, // Select size
true // select-multiple
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Standalone select field<br />// Labels an Values<br /> $fieldBData = array(<br /> array("label"=>"b1","value"=>"1"), <br /> array("label"=>"b2","value"=>"2"),<br /> array("label"=>"b3","value"=>"3") <br /> );<br /> <br />echo $formAt->addSelectList(
"Field_B", // Name
$fieldBData, // Data<br /> "fieldStyle", // Css Style<br /> array(1,3), // Selected <br /> 'style="background-color:#ccc"', // Added style <br /> 3, // Select size<br /> true // select-multiple<br />);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top">Field C </td>
<td><?
// Standalone checkboox-set
// Labels an Values
$fieldCData = array(
array("label"=>"c1","value"=>"1"),
array("label"=>"c2","value"=>"2"),
array("label"=>"c3","value"=>"3")
);
echo $formAt->addCheckBox("Field_C", // Name
$fieldCData, // Data
"fieldStyle", // Css Style
array(2), // Checked
'onClick="alert(\'onClick Event\')"' // Javascript code
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Standalone checkboox-set
// Labels an Values
$fieldCData = array(
array("label"=>"c1","value"=>"1"),
array("label"=>"c2","value"=>"2"),
array("label"=>"c3","value"=>"3")
);
echo $formAt->addCheckBox(
"Field_C", // Name
$fieldCData, //Data
"fieldStyle", // Css Style
array(2), // Checked
'onClick="alert(\'onClick Event\')"' // Javascript code
);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#EAEAEA">Field D </td>
<td bgcolor="#EAEAEA">
<?
// Labels an Values
$fieldDData = array(
array("label"=>"d1","value"=>"1"),
array("label"=>"d2","value"=>"2"),
array("label"=>"d3","value"=>"3")
);
echo $formAt->addRadio("Field_C", // Name
$fieldDData, // Data
"radioCheckStyle", // Css Style
"1", // Checked
'onClick="alert(this.value)"' // Javascript code
);
?> <br />
<div align="left">
<pre style="font-size:9px">// Standalone checkboox-set
// Labels an Values
$fieDdCData = array(
array("label"=>"c1","value"=>"1"),
array("label"=>"c2","value"=>"2"),
array("label"=>"c3","value"=>"3")
);
echo $formAt->addCheckBox(
"Field_D", // Name
$fieldDData, //Data
"radioCheckStyle", // Css Style
1, // Checked
'onClick="alert(this.value)"' // Javascript code
);</pre>
</div></td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td><input name="Reset" type="reset" class="fieldStyle" style="width:100px" value="Reset" />
<label>
<input name="Submit2" type="submit" class="fieldStyle" style="width:100px" value="Submit" disabled="disabled" />
</label></td>
</tr>
</table>
</form>
<p class="style1"> </p>
</td>
</tr>
</table>
<p> </p>
</body>
</html>
|