-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
150 lines (126 loc) · 5.54 KB
/
index.html
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html>
<head>
<title>Template page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.css" />
<link rel="stylesheet" href="css/sme.min.css" />
<script src="scripts/jquery.js"></script>
<script src="scripts/jquerymobile.js"></script>
<script type="text/javascript">
function getsId1(event)
{
/*var idcount = event.data.i;
$("gridtable").remove
$("#gridtable").append("<tr><td width='0%' style='padding:0%; margin:0%; visibility:hidden'><input type='hidden' id='SurveyID'></td><td><input type='text' id='name' name='name' /></td><td><input type='text' id='desc' name='desc' /></td><td><center><div data-role='controlgroup' data-mini='true' data-type='horizontal'><a href='index.html' id='neadd'"+(i)+" data-iconpos='notext' data-icon='plus' data-role='button'>Yes</a><a href='index.html' id='purge' data-iconpos='notext' data-icon='delete' data-role='button'>No</a></div></center></td></tr>").trigger('create');*/
$.mobile.changePage("addOption.html", {transition: "slideup"});
}
function getsId(event)
{
var name;
var desc;
//alert("called");
var this2=event.data.myid;
alert(this2);
$(this2).parent().parent().find("td").each(function()
{
if($(this).id=="name");
name=$("#name").val();
if($(this).id=="desc");
desc=$("#desc").val();
});
var d=new Date();
var currDate = d.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate();
//+" "+d.getHours+":"+d.getMinutes+":"+d.getSeconds
//console.info(currDate);
var jsonObject = new Object();
jsonObject.SurveyId="";
jsonObject.name=name;
jsonObject.desc=desc;
jsonObject.cdate=currDate;
//console.info(JSON.stringify(jsonObject));
$.ajax({url:"index.html",type:"post",data:jsonObject,datatype: "json",success:function(result){
alert("correct (y)");
//var j = $.parseJSON(result);
//var ID = j[0];
//localStorage["surveyId"] = 1234;
}});
}
$(document).ready(function(){
//$.ajax({url:"index.html",success:function(result){
//alert("correct (y)");
// var jsonObj = []; //declare object
/*for (var i = 0; i < 5; i++) {
jsonObj.push({"SurveyId":1,"name":"name1","desc":"desc1" });
jsonObj.push({"SurveyId":2,"name":"name2","desc":"desc2" });
jsonObj.push({"SurveyId":3,"name":"name3","desc":"desc3" });
}*/
var result2={"survey":[
{
"name":"blah",
"SurveyID":"1234",
"desc":"this isnotasurvey"
},
{
"name":"blah32",
"SurveyID":"12we",
"desc":"thisis notasurvey"
}]
}
/*var j = JSON.parse(jsonObj);
$(j).each(function()
{
$("#gridtble").append
($("<tr><td id='SurveyId' type='hidden' value='$(this).SurveyId'></td><td id='name' type='text' value='$(this).name'></td><td id='desc' type='text' value='$(this).desc'></td></tr>"))
})*/
/*var htmlStr;
for(var i=0; i<result2.survey.length; i++)
{
$("#gridtble").append
("<tr><td id='SurveyId' type='hidden' value='$(this).SurveyId'></td><td id='name' type='text' value='$(this).name'></td><td id='desc' type='text' value='$(this).desc'></td></tr>");
}*/
var htmlStr;
for(var i=0; i<result2.survey.length; i++) {
//console.info(result2.survey[i].desc);
$("#gridtable").append("<tr><td width='0%' style='padding:0%; margin:0%; visibility:hidden'><input type='hidden' id='SurveyId' value="+result2.survey[i].SurveyID+"></td><td><input id='name' type='text' value="+result2.survey[i].name+" /></td><td><input type='text' id='desc' type='text' value="+result2.survey[i].desc+" /></td><td><center><div data-role='controlgroup' data-mini='true' data-type='horizontal'><a href='index.html' id='neadd"+i+"' data-iconpos='notext' data-icon='plus' data-role='button'>Yes</a><a href='index.html' id='purge"+i+"' data-iconpos='notext' data-icon='delete' data-role='button'>No</a></div></center></td></tr>").trigger('create');
$("#neadd"+i).click({myid: result2.survey[i].SurveyID},getsId);
}
$("#gridtable").append("<tr><td width='0%' style='padding:0%; margin:0%; visibility:hidden'><input type='hidden' id='SurveyID'></td><td><input type='text' id='name' name='name' /></td><td><input type='text' id='desc' name='desc' /></td><td><center><div data-role='controlgroup' data-mini='true' data-type='horizontal'><a href='index.html' id='newadd' data-iconpos='notext' data-icon='plus' data-role='button'>Yes</a><a href='index.html' id='purge' data-iconpos='notext' data-icon='delete' data-role='button'>No</a></div></center></td></tr>").trigger('create');
$("#newadd").click({count:i},getsId1);
//}});
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-theme="c">
<a data-role="button" href="#page1" data-icon="home" data-iconpos="left" class="ui-btn-left">Home</a>
<h3>
Survey.Me
</h3>
<a data-role="button" href="#page1" class="ui-btn-right">Logout</a>
</div><!-- /header -->
<div data-role="content" data-theme="c">
<!--<p>The grid goes here.</p>-->
<form name="mainpageform" id="mainpageform" method="post">
<table class="ui-table" border="1" id="gridtable">
<tr>
<td width="0%" style="padding:0%; margin:0%; visibility:hidden">
<input type="hidden">
</td>
<td style="width:43%;">
<h3>Name</h3>
</td>
<td style="width:42%;">
<h3>Description</h3>
</td>
<td style="width:15%; text-align:center;">
<h3>Actions</h3>
</td>
</tr>
</table> <!--table-->
</form>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>