django_pfm/pfm/templates/pfm/tr_edit_form.html
2017-10-31 16:37:02 +03:00

28 lines
1.1 KiB
HTML

<div>
<div><label>Type</label>{{ form.tr_type }} </div>
<div id='cat' height = 44px> <label>Category</label>{{ form.tr_cat }}</div>
<div><label>Date</label>{{ form.tr_date }}</div>
<div><label>Account</label>{{ form.tr_acc }}</div>
<div><label>Amount</label>{{ form.tr_amount }}</div>
<div><label>Notes</label>{{ form.tr_note }} </div></div>
<!--button type="submit" name="action" value="create" class="waves-effect waves-light btn-large blue">Save</button>
<button type="submit" name="action" value="edit" class="waves-effect waves-light btn-large blue">Save</button>
<button type="submit" name="action" value="delete" class="waves-effect waves-light btn-large blue">Delete</button-->
</div>
<script>
$(document).ready( function() {
if ($("input[name='id']")){
console.log($("input[name='id']").val());}
else {console.log("no id");}
$('#id_tr_type').on('change', function() {
$('#cat').html("<label>Category</label> loading...");
$.ajax({
type: 'GET',
data: {type: $(this).val()},
success: function(form){$('#cat').html(form)}
})
});
});
</script>