check print copy greater than 0 in print_settings

This commit is contained in:
phyusin
2017-11-27 19:33:18 +06:30
7 changed files with 67 additions and 29 deletions

View File

@@ -15,7 +15,7 @@
<%= f.input :api_settings %>
<%= f.input :page_width %>
<%= f.input :page_height %>
<%= f.input :print_copies %>
<%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
<%= f.input :precision %>
<%= f.input :delimiter %>
<%= f.input :heading_space %>
@@ -58,4 +58,19 @@
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function greaterThanOne(val){
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
}
</script>