forked from walpolea/Formulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.php
59 lines (55 loc) · 1.11 KB
/
Example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once "Formulator.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>Formulator Example</title>
</head>
<body>
<script>
function blurred() {
alert("Formulator set my onblur function!");
}
</script>
<?php
//Create (or load in) your JSON-based form
$formdata = '{
"action": "formtest.php",
"method": "GET",
"inputs": [
{
"label": {
"content": "Name: ",
"class": "inputLabel"
},
"id": "name",
"name": "name",
"type": "text",
"size": "50",
"onblur": "blurred();"
},
{
"label": {
"content": "Password: ",
"class": "inputLabel"
},
"id": "password",
"name": "password",
"type": "password",
"size": "25"
},
{
"id": "submit",
"name": "submit",
"type": "submit",
"value": "Submit"
}
]
}';
//create the form
$formulator = new Formulator();
echo $formulator->formify( $formdata );
?>
</body>
</html>