-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.cfm
84 lines (64 loc) · 2.21 KB
/
table.cfm
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<cfscript>
variables.Users = [
{id : 1, firstName : "Joe", LastName : "Clinton", Email : "j.clinton@mail.net"},
{id : 2, firstName : "Jackie", LastName : "Bush", Email : "j.bush@mail.net"},
{id : 3, firstName : "John", LastName : "Dole", Email : "j.dole@mail.net"},
{id : 4, firstName : "Jennifer", LastName : "Ford", Email : "j.ford@mail.net"},
{id : 10, firstName : "Jerry", LastName : "Springfield", Email : "j.spring@mail.net"}
];
</cfscript>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Form Utils!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
</head>
<body>
<section class="section">
<div class="container">
<p>
<a href="index.cfm" class="button is-primary">Basic Example</a>
<a href="table-old.cfm" class="button is-primary">Table without Form Util</a>
</p>
<p> </p>
<cfif cgi.request_method IS "post">
<cfset util = new formutils.FormUtils().init() />
<cfset util.buildFormCollections(form) />
<div class="columns">
<div class="column">
<cfdump var="#variables.users#" label="variables.user - Original">
</div>
<div class="column">
<cfdump var="#form.user#" label="form.user - Result">
</div>
</div>
</cfif>
<form name="testform" action="?" method="post">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
</thead>
<cfoutput>
<cfloop array="#variables.Users#" item="user" index="i">
<tr>
<td><input type="number" class="input" name="user[#i#].ID" value="#EncodeForHTMLAttribute(User.ID)#" /></td>
<td><input type="text" class="input" name="user[#i#].FirstName" value="#EncodeForHTMLAttribute(User.FirstName)#" /></td>
<td><input type="text" class="input" name="user[#i#].LastName" value="#EncodeForHTMLAttribute(User.LastName)#" /></td>
<td><input type="email" class="input" name="user[#i#].Email" value="#EncodeForHTMLAttribute(User.Email)#" /></td>
</tr>
</cfloop>
</cfoutput>
</table>
<button type="submit" class="button is-primary">Save data</button>
</form>
</div>
</section>
</body>
</html>