π₯ Case β Customers Application in AppML: Build a Full CRUD App Without JavaScript
π§² Introduction β Why Build a Customer App with AppML?
Customer management is a classic use case for web applicationsβused by businesses, schools, and service providers alike. With AppML, you can create a complete CRUD (Create, Read, Update, Delete) customers application using only HTML, models, and optional controllersβno JavaScript frameworks required.
π― In this case study, youβll learn:
- How to create a customer listing and form in AppML
- How to structure the JSON data and model
- How to add filters, form submission, and validation
- How to connect with server-side scripts for saving and editing
π§Ύ File Structure Overview
π File Name | π Description |
---|---|
customers.html | Main UI layout |
data/customers.json | Customer data records |
models/customer-model.json | Field structure and validation rules |
controllers/customer.js | (Optional) filtering or form logic |
π Example β data/customers.json
[
{ "id": 1, "name": "Alice Smith", "email": "alice@example.com", "city": "New York" },
{ "id": 2, "name": "Bob Johnson", "email": "bob@example.com", "city": "Chicago" }
]
βοΈ Flat structure with key-value pairs for each customer.
π Example β models/customer-model.json
{
"key": "id",
"orderby": "name",
"rows": 10,
"fields": [
{ "name": "name", "required": true },
{ "name": "email", "required": true },
{ "name": "city" }
]
}
βοΈ Adds validation (required fields), sorting, and pagination.
π₯οΈ Main HTML β customers.html
<div
appml-model="models/customer-model.json"
appml-data="data/customers.json"
appml-controller="controllers/customer.js"
appml-message>
<h2>Customer List</h2>
<p>{{name}} β {{email}} β {{city}}</p>
<h3>Add / Edit Customer</h3>
<input name="name" placeholder="Full Name">
<input name="email" placeholder="Email">
<input name="city" placeholder="City">
<button appml-submit>Save</button>
</div>
π Adding a Controller β customer.js
myAppML.onvalidate = function() {
if (!myAppML.data.email.includes("@")) {
myAppML.message = "Invalid email address.";
return false;
}
return true;
};
myAppML.onshow = function() {
myAppML.filter = "city != ''";
};
βοΈ Adds a custom validation and filters out blank-city entries.
π Connecting to a Backend (Optional)
If you’re using PHP, ASP, or Node.js to persist data, update the appml-data
to point to your API:
<div appml-data="api/save-customer.php" ...>
And handle POST/PUT on the backend:
// save-customer.php
$data = json_decode(file_get_contents("php://input"), true);
// Save to database...
echo json_encode(["success" => true]);
π UI Features Included
β
Customer listing
β
Live editing
β
Inline form validation
β
Record pagination
β
Sorting and filtering
β
Optional controller for business logic
β
Optional server API for persistence
π Summary β Recap & Key Takeaways
The AppML Customers application shows how to build a full CRUD interface using only HTML + data + models. Itβs lightweight, easy to extend, and suitable for small business apps, admin dashboards, and student projects.
π Key Takeaways:
- Define structure with
appml-model
- Load and display customer data with
appml-data
- Use forms +
appml-submit
for create/update - Add controllers for validations and filters
- Optional: connect to backend to store data
βοΈ You now have a fully working customer management systemβpowered entirely by AppML.
β FAQs β Customers App in AppML
β Can I add search or filter by city?
β
Yes. Use an <input>
with oninput="myAppML.filter='city=='+this.value"
for live filtering.
β Can this app save data back to JSON files?
β No. You need a server-side API to handle file or database writing.
β Is it mobile-friendly?
β
Yes. AppML is HTML-based and works responsively with proper CSS.
β Can I integrate this with a database like MySQL?
β
Absolutely. Use a PHP script to query your DB and return JSON to AppML.
β Can I reuse this form in other pages?
β
Yes. Wrap the form in a reusable component and use appml-include
.
Share Now :