// live demo
Config-driven dynamic forms
Every field, rule and condition below comes from config — the same idea I used for receiver details and sender questions in international money transfers. Try it: pick a country, change the delivery method, or enter an amount above 1000 to reveal compliance fields. Submit empty to see all errors reported at once.
Sample rules and data are made up for this demo.
config/in.json
{
"name": "India",
"currency": "INR",
"deliveryMethods": [
"Bank account",
"UPI",
"Cash pickup"
],
"fields": [
{
"id": "amount",
"label": "Amount to send (USD)",
"type": "number",
"rules": {
"required": true,
"min": 10,
"max": 5000
}
},
{
"id": "method",
"label": "Delivery method",
"type": "select",
"options": [
"Bank account",
"UPI",
"Cash pickup"
],
"rules": {
"required": true
}
},
{
"id": "fullName",
"label": "Receiver full name",
"type": "text",
"rules": {
"required": true,
"minLength": 3
}
},
{
"id": "ifsc",
"label": "IFSC code",
"type": "text",
"placeholder": "SBIN0001234",
"showIf": {
"field": "method",
"in": [
"Bank account"
]
},
"rules": {
"required": true,
"pattern": "^[A-Z]{4}0[A-Z0-9]{6}$",
"patternMessage": "IFSC must look like SBIN0001234"
}
},
{
"id": "account",
"label": "Account number",
"type": "text",
"showIf": {
"field": "method",
"in": [
"Bank account"
]
},
"rules": {
"required": true,
"pattern": "^\\d{9,18}$",
"patternMessage": "Account number must be 9–18 digits"
}
},
{
"id": "upi",
"label": "UPI ID",
"type": "text",
"placeholder": "name@bank",
"showIf": {
"field": "method",
"in": [
"UPI"
]
},
"rules": {
"required": true,
"pattern": "^[\\w.-]+@[\\w]+$",
"patternMessage": "UPI ID must look like name@bank"
}
},
{
"id": "purpose",
"label": "Purpose of transfer",
"type": "select",
"options": [
"Family support",
"Education",
"Medical",
"Savings"
],
"showIfAmountAtLeast": 1000,
"rules": {
"required": true
}
},
{
"id": "pan",
"label": "Receiver PAN",
"type": "text",
"placeholder": "ABCDE1234F",
"showIfAmountAtLeast": 2500,
"rules": {
"required": true,
"pattern": "^[A-Z]{5}\\d{4}[A-Z]$",
"patternMessage": "PAN must look like ABCDE1234F"
}
}
]
}No code changes
New fields or rules ship by editing config, not components.
One-pass validation
All missing or invalid fields are reported together, reducing friction.
Per-market isolation
Each country has its own config, so changing one never breaks another.