Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

AppML Case Study - Categories

The HTML Page

This is the HTML source:

<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>

<div class="w3-container w3-content">
<div id="Form01" class="w3-container w3-light-grey w3-padding-large w3-margin-bottom" appml-data="appml.php?model=model_categoriesform" appml-controller="myFormController" style="display:none;">
  <div appml-include-html="inc_formcommands.htm"></div>
    <input id="CategoryName" class="w3-input w3-border">
    <input id="Description" class="w3-input w3-border">

<div appml-data="appml.php?model=model_categorieslist">
<div appml-include-html="inc_listcommands_nofilter.htm"></div>
<table class="w3-table-all">
  <tr appml-repeat="records">
    <td style="cursor:pointer" onclick="appml('Form01').run({{CategoryID}})">&#9998;</td>

function myFormController($appml) {
  if ($appml.message == "ready") {return -1;}
  if ($appml.message == "loaded") {
    document.getElementById("Form01").style.display = "";



These are the models used in the application:

List Model

"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Categories"

Form Model

"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Categories",
"maintable" : "Categories",
"keyfield" : "CategoryID"
"updateItems" : [
{"item" : "CategoryName"},
{"item" : "Description"}