Commit 2601843e authored by Ad Schellevis's avatar Ad Schellevis Committed by GitHub

Merge pull request #1278 from fabianfrz/validation_message

add validation message
parents fc39bb33 fc1a15df
...@@ -174,12 +174,18 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -174,12 +174,18 @@ POSSIBILITY OF SUCH DAMAGE.
* link actual voucher generation in dialog * link actual voucher generation in dialog
*/ */
$("#generateVoucherBtn").click(function(){ $("#generateVoucherBtn").click(function(){
$('#generatevouchererror').html('');
$('#generatevouchererror').hide();
var voucher_provider = $('#voucher-providers').find("option:selected").val(); var voucher_provider = $('#voucher-providers').find("option:selected").val();
var voucher_validity = $("#voucher-validity").val(); var voucher_validity = $("#voucher-validity").val();
var voucher_quantity = $("#voucher-quantity").val(); var voucher_quantity = $("#voucher-quantity").val();
var voucher_groupname = $("#voucher-groupname").val(); var voucher_groupname = $("#voucher-groupname").val();
if (!$.isNumeric(voucher_validity) || !$.isNumeric(voucher_quantity)) { if (!$.isNumeric(voucher_validity) || !$.isNumeric(voucher_quantity)) {
// don't try to generate vouchers then validity or quantity are invalid // don't try to generate vouchers then validity or quantity are invalid
var error = $('<p />');
error.text("{{ lang._('The validity and the quantity of vouchers must be integers.') }}");
$('#generatevouchererror').append(error);
$('#generatevouchererror').show();
return; return;
} }
ajaxCall(url="/api/captiveportal/voucher/generateVouchers/" + voucher_provider + "/", ajaxCall(url="/api/captiveportal/voucher/generateVouchers/" + voucher_provider + "/",
...@@ -384,6 +390,7 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -384,6 +390,7 @@ POSSIBILITY OF SUCH DAMAGE.
<h4 class="modal-title">{{ lang._('Generate vouchers') }}</h4> <h4 class="modal-title">{{ lang._('Generate vouchers') }}</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div id="generatevouchererror" class="alert alert-danger" role="alert" style="display: none"></div>
<table class="table table-striped table-condensed table-responsive"> <table class="table table-striped table-condensed table-responsive">
<thead> <thead>
<tr> <tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment