|
|
ToDo:
|
|
application: hikazou version: 1 runtime: python api_version: 1 handlers: - url: /js static_dir: js - url: /js/(.*\.js) static_files: js/\1 upload: js/(.*\.js) - url: /.* script: main.pyindex.htmlは…(お恥ずかしいのですが、まずは晒す)
<html>
<head>
<script language="javascript" type="text/javascript" src="/js/jquery.js">
<!--
-->
</script>
<title>test</title>
</head>
<body>
<form action="/delete" method="post" onsumit="return checkMark();">
<table border="1" id="table_1">
<tr>
<th>チェック</th>
<th>タイトル</th>
<th>著者</th>
<th>価格</th>
<th>書店</th>
<th>場所</th>
</tr>
{% for purchase in purchase_list %}
<tr>
<td><input id="{{ purchase.key }}" type="radio" /></td>
<td id="title_{{ purchase.key }}" >{{ purchase.book.title|escape }}</td>
<td id="author_{{ purchase.key }}">{{ purchase.book.author|escape }}</td>
<td id="price_{{ purchase.key }}">{{ purchase.book.price|escape }}</td>
<td id="name_{{ purchase.key }}">{{ purchase.shop.name|escape }}</td>
<td id="place_{{ purchase.key }}">{{ purchase.shop.place|escape }}</td>
</tr>
{% endfor %}
</table>
<input type="submit" name="delete" value="Delete" />
</form>
<form action="/entry" method="post" onsubmit="return checkSubmit();">
</table>
<lable>タイトル:<input type="text" name="title" id="title"/></label>
<label>著者:<input type="text" name="author" id="author"/></label>
<label>価格:<input type="text" name="price" id="price"/></label>
<label>書店:<input type="name" name="name" id="name"/></label>
<label>場所:<input type="place" name="place" id="place"/></label>
<input type="submit" name="OK" id="OK_button"/>
</form>
</body>
<script language="javascript" type="text/javascript">
<!--
var before_checked = null;
$(':radio').click(function(){
if ( this == before_checked ) return ;
this.checked = true;
if ( before_checked != null){
before_checked.checked = false;
}
before_checked = this;
$('#title').val($('#title_' + $(this).attr('id')).text());
$('#author').val($('#author_' + $(this).attr('id')).text());
$('#price').val($("#price_" + $(this).attr('id')).text());
$('#name').val($("#name_" + $(this).attr('id')).text());
$('#place').val($("#place_" + $(this).attr('id')).text());
}
);
$('#price').change(function(){
if (isNaN($('#price').val())){
alert('you need numeric parameter');
}
});
function checkMark(){
}
function checkSubmit(){
if (isNaN($('#price').val())){
alert('you need numeric parameter');
return false;
}
return true;
}
-->
</script>
</html>