Implement jQuery mask plugin w/ IP address inputs

This commit is contained in:
billz 2023-11-09 22:48:39 +00:00
parent 1d5ee03324
commit a3230d0684
4 changed files with 18 additions and 7 deletions

View file

@ -368,7 +368,15 @@ $('#js-sys-reboot, #js-sys-shutdown').on('click', function (e) {
});
$(document).ready(function(){
$("#PanelManual").hide();
$("#PanelManual").hide();
$('.ip_address').mask('0ZZ.0ZZ.0ZZ.0ZZ', {
translation: {
'Z': {
pattern: /[0-9]/, optional: true
}
},
placeholder: "___.___.___.___"
});
});
$('#wg-upload,#wg-manual').on('click', function (e) {

View file

@ -148,6 +148,9 @@ initializeApp();
<!-- SB-Admin-2 JavaScript -->
<script src="dist/sb-admin-2/js/sb-admin-2.js"></script>
<!-- jQuery Mask plugin -->
<script src="dist/jquery-mask/jquery.mask.min.js"></script>
<!-- Custom RaspAP JS -->
<script src="app/js/custom.js"></script>

View file

@ -37,7 +37,7 @@
<div class="row">
<div class="form-group col-md-6" required>
<label for="code"><?php echo _("IP Address"); ?></label>
<input type="text" class="form-control" id="txtipaddress" name="StaticIP" />
<input type="text" class="form-control ip_address" id="txtipaddress" name="StaticIP" maxlength="15" />
<div class="invalid-feedback">
<?php echo _("Please provide a valid IP Address."); ?>
</div>
@ -47,7 +47,7 @@
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Subnet Mask"); ?></label>
<input type="text" class="form-control" id="txtsubnetmask" name="SubnetMask" />
<input type="text" class="form-control ip_address" id="txtsubnetmask" name="SubnetMask" maxlength="15" />
<div class="invalid-feedback">
<?php echo _("Please provide a valid Subnet mask."); ?>
</div>
@ -57,7 +57,7 @@
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Default gateway"); ?></label>
<input type="text" class="form-control" id="txtgateway" name="DefaultGateway" />
<input type="text" class="form-control ip_address" id="txtgateway" name="DefaultGateway" maxlength="15" />
<div class="invalid-feedback">
<?php echo _("Please provide a valid Default gateway."); ?>
</div>
@ -107,7 +107,7 @@
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Starting IP Address"); ?></label>
<input type="text" class="form-control" id="txtrangestart" name="RangeStart" />
<input type="text" class="form-control ip_address" id="txtrangestart" name="RangeStart" maxlength="15" />
<div class="invalid-feedback">
<?php echo _("Please provide a valid Starting IP Address."); ?>
</div>
@ -117,7 +117,7 @@
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Ending IP Address"); ?></label>
<input type="text" class="form-control" id="txtrangeend" name="RangeEnd" />
<input type="text" class="form-control ip_address" id="txtrangeend" name="RangeEnd" maxlength="15" />
<div class="invalid-feedback">
<?php echo _("Please provide a valid Ending IP Address."); ?>
</div>

View file

@ -33,7 +33,7 @@
<input type="text" name="mac" value="" placeholder="<?php echo _("MAC address") ?>" class="form-control" autofocus="autofocus">
</div>
<div class="col-md-3 col-xs-3">
<input type="text" name="ip" value="" placeholder="<?php echo _("IP address") ?>" class="form-control">
<input type="text" name="ip" value="" placeholder="<?php echo _("IP address") ?>" class="form-control ip_address" maxlength="15">
</div>
<div class="col-md-3 col-xs-3">
<input type="text" name="comment" value="" placeholder="<?php echo _("Optional comment") ?>" class="form-control">