Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.html
More file actions
Latest commit
162 lines (143 loc) · 6.11 KB
/
Copy pathinput.html
File metadata and controls
162 lines (143 loc) · 6.11 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<htmllang="ja">
<head>
<metacharset="utf-8">
<metahttp-equiv="X-UA-Compatible" content="IE=edge">
<metaname="viewport" content="width=device-width, initial-scale=1">
<title>アクティビティ入力</title>
<linkhref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
// 現在日付を取得
varjnow=jQuery.now();
varnowdate=newDate(jnow);
varyyyymmdd=nowdate.getFullYear()
+""+("0"+(nowdate.getMonth()+1)).slice(-2)
+""+("0"+nowdate.getDate()).slice(-2);
// 現在日付を設定
var$aform=$('#actvform');
$aform.find("[name=date]").val(yyyymmdd);
// 編集不可の設定
$aform.find("[name=date]").attr("readonly",true);
// ページ読み込み時にユーザーID取得
varuserId=localStorage.getItem("userId");
//var userId = "devdebu@devdebu.com";
$aform.find("[name=userId]").val(userId);
// サンプル値をランダムでセット
//$aform.find("[name=weight]").val(jnow%10+50);
//$aform.find("[name=fat]").val(jnow%5+19);
//$aform.find("[name=step]").val(jnow%30000);
//});
//jQuery(function($){
$(".btn_ajax").on("click",function(e){
varbutton=$(this);
alert("入力内容を登録します");
// 操作対象のフォーム要素を取得
var$form=$("#actvform");
// 送信
$.ajax({
// 送信先URL
url:'https://deboo.mybluemix.net/v1/activity',
type: 'POST',
data: $form.serialize(),
timeout: 10000,// milliSecond
success: function(result,textStatus,xhr){
// 入力値を初期化
$form[0].reset();
// 現在日付を取得
varjnow=jQuery.now();
varnowdate=newDate(jnow);
varyyyymmdd=nowdate.getFullYear()
+""+("0"+(nowdate.getMonth()+1)).slice(-2)
+""+("0"+nowdate.getDate()).slice(-2);
// 現在日付を設定
var$aform=$('#actvform');
$aform.find("[name=date]").val(yyyymmdd);
// 編集不可の設定
$aform.find("[name=date]").attr("readonly",true);
$("#errorMsg").html("");
$("#errorMsg").append(" <div class='alert alert-danger' id='myAlert'></div>");
$("#myAlert").append("登録しました。");
},
error: function(xhr,textStatus,error){
$("#errorMsg").html("");
$("#errorMsg").append(" <div class='alert alert-danger' id='myAlert'></div>");
$("#myAlert").append("登録に失敗しました。");
}
});
});
});
</script>
<!-- css from myroom -->
<STYLEtype="text/css">
BODY{color: white ;background-color:#272B30}
table{color: black;}
.debu-label{display: inline-block;width:6em;text-align:right;}
.debu-txt{display: inline-block;width:20em; margin-left:0.5em ;color: black;}
.debuBox{width:12em; background-color:lightskyblue; border:2px white double; margin-top:1em; margin-right:1em; margin-bottom:1em; margin-left:auto}
.debuVal{width:8em; display: inline-block;text-align: right;margin-left:0.5em;}
</STYLE>
</head>
<body>
<navclass="navbar navbar-inverse">
<divclass="container-fluid">
<divclass="navbar-header">
<buttontype="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbarEexample7">
<spanclass="sr-only">Toggle navigation</span>
<spanclass="icon-bar"></span>
<spanclass="icon-bar"></span>
<spanclass="icon-bar"></span>
</button>
<aclass="navbar-brand" href="myroom.html">DevDebu</a>
</div>
<divclass="collapse navbar-collapse" id="navbarEexample7">
<ulclass="nav navbar-nav">
<li><ahref="user.html">基本情報修正</a></li>
<li><ahref="myroom.html">マイルームに戻る</a></li>
</ul>
</div>
</div>
</nav>
<divclass="container-fluid">
<divclass="row-fluid">
<divclass="col-xs-12 col-md-6 panel-primary">
<divclass="panel-heading">
<divclass="panel-title">アクティビティ</div>
</div>
<divclass="panel-body panel">
<formmethod="POST" id="actvform" name="actvform">
<divclass="login-block">
<divclass="input-group margin-bottom-20">
<spanclass="input-group-addon rounded-left glyphicon glyphicon-calendar"></span>
<inputtype="text" class="form-control rounded-right" id="date" name="date">
</div>
<divclass="input-group margin-bottom-20">
<spanclass="input-group-addon rounded-left glyphicon glyphicon-scale"></span>
<inputtype="number" class="form-control rounded-right" id="weight" placeholder="体重(kg)を入力してください。" name="weight">
</div>
<divclass="input-group margin-bottom-20">
<spanclass="input-group-addon rounded-left glyphicon glyphicon-dashboard"></span>
<inputtype="number" class="form-control rounded-right" id="fat" placeholder="体脂肪率(%)を入力してください。" name="fat">
</div>
<divclass="input-group margin-bottom-20">
<spanclass="input-group-addon rounded-left glyphicon glyphicon-fire"></span>
<inputtype="number" class="form-control rounded-right" id="step" placeholder="歩数を入力してください。" name="step">
</div>
<inputtype="hidden" name="userId" id="userId">
<divclass="row margin-bottom-70">
<divclass="col-md-12">
<buttontype="button" class ="btn btn-danger btn-block btn_ajax" action="actvform">INPUT</button>
</div>
</div>
</div>
</form>
<divid = "errorMsg"></div>
</div>
</div>
</div>
</div>
</body>
</html>