AppML Case Study - Shippers
The HTML Page
This is the HTML source:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Shippers</title>
<link rel="stylesheet" href="http://tutorials/lib/subhodaya.css">
<script src="http://tutorials/appml/2.0.3/appml.js"></script>
</head>
<body>
<div class="subhodaya-container subhodaya-content">
<h1>Shippers</h1>
<div id="Form01" class="subhodaya-container subhodaya-light-grey subhodaya-padding-jumbo subhodaya-margin-bottom" appml-data="appml.php?model=model_shippersform" appml-controller="myFormController" style="display:none;">
<div appml-include-html="inc_formcommands.htm"></div>
<p>
<label>ShipperName:</label>
<input id="ShipperName" class="subhodaya-input subhodaya-border">
</p>
<p>
<label>Phone:</label>
<input id="Phone" class="subhodaya-input subhodaya-border">
</p>
</div>
<div appml-data="appml.php?model=model_shipperslist">
<div appml-include-html="inc_listcommands_nofilter.htm"></div>
<table class="subhodaya-table-all">
<tr>
<th></th>
<th>Shipper</th>
<th>Phone</th>
</tr>
<tr appml-repeat="records">
<td style="cursor:pointer" onclick="appml('Form01').run({{ShipperID}})">✎</td>
<td>{{ShipperName}}</td>
<td>{{Phone}}</td>
</tr>
</table>
</div>
</div>
<script>
function myFormController($appml) {
if ($appml.message == "ready") {return -1;}
if ($appml.message == "loaded") {
document.getElementById("Form01").style.display = "";
}
}
</script>
</body>
</html>
PHP »
.NET »
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Shippers</title>
<link rel="stylesheet" href="http://tutorials/lib/subhodaya.css">
<script src="http://tutorials/appml/2.0.3/appml.js"></script>
</head>
<body>
<div class="subhodaya-container subhodaya-content">
<h1>Shippers</h1>
<div id="Form01" class="subhodaya-container subhodaya-light-grey subhodaya-padding-jumbo subhodaya-margin-bottom" appml-data="appml.php?model=model_shippersform" appml-controller="myFormController" style="display:none;">
<div appml-include-html="inc_formcommands.htm"></div>
<p>
<label>ShipperName:</label>
<input id="ShipperName" class="subhodaya-input subhodaya-border">
</p>
<p>
<label>Phone:</label>
<input id="Phone" class="subhodaya-input subhodaya-border">
</p>
</div>
<div appml-data="appml.php?model=model_shipperslist">
<div appml-include-html="inc_listcommands_nofilter.htm"></div>
<table class="subhodaya-table-all">
<tr>
<th></th>
<th>Shipper</th>
<th>Phone</th>
</tr>
<tr appml-repeat="records">
<td style="cursor:pointer" onclick="appml('Form01').run({{ShipperID}})">✎</td>
<td>{{ShipperName}}</td>
<td>{{Phone}}</td>
</tr>
</table>
</div>
</div>
<script>
function myFormController($appml) {
if ($appml.message == "ready") {return -1;}
if ($appml.message == "loaded") {
document.getElementById("Form01").style.display = "";
}
}
</script>
</body>
</html>
Models
These are the models used in the application:
List Model
{
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Shippers"
}
}
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Shippers"
}
}
Form Model
{
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Shippers",
"maintable" : "Shippers",
"keyfield" : "ShipperID"
},
"updateItems" : [
{"item" : "ShipperName"},
{"item" : "Phone"}
]
}
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Shippers",
"maintable" : "Shippers",
"keyfield" : "ShipperID"
},
"updateItems" : [
{"item" : "ShipperName"},
{"item" : "Phone"}
]
}