Force entry of correct mac address before save is enabled
Move focus to Mac field and stay until a correct Mac address is entered, disabling Save buttons until correct Motive: a device record with an empty Mac address requires manual removal.
This commit is contained in:
parent
d43570b471
commit
1f910c7e97
|
@ -214,12 +214,19 @@ $(document).ready(function () {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#sccp_hw_mac').change(function() {
|
$('#sccp_hw_mac').focus();
|
||||||
|
|
||||||
|
$('#sccp_hw_mac').focusout(function() {
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
const regex = new RegExp('^([0-9A-Fa-f]{2}[:.-]?){5}([0-9A-Fa-f]{2})$');
|
const regex = new RegExp('^([0-9A-Fa-f]{2}[:.-]?){5}([0-9A-Fa-f]{2})$');
|
||||||
if ( regex.test(value) === false ) {
|
if ( regex.test(value) === false ) {
|
||||||
|
$('#ajaxsubmit2').attr('disabled', 'disabled');
|
||||||
|
$('#ajaxsubmit').attr('disabled', 'disabled');
|
||||||
fpbxToast(_('Invalid Mac Address'),_('Invalid Mac Address'), 'warning');
|
fpbxToast(_('Invalid Mac Address'),_('Invalid Mac Address'), 'warning');
|
||||||
setTimeout(function(){document.getElementById("sccp_hw_mac").focus();},2000);
|
setTimeout(function(){ $('#sccp_hw_mac').focus();},2000);
|
||||||
|
} else {
|
||||||
|
$('#ajaxsubmit2').removeAttr('disabled');
|
||||||
|
$('#ajaxsubmit').removeAttr('disabled');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1253,8 +1253,9 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
<label>Device SEP ID.[XXXXXXXXXXXX]=MAC</label>
|
<label>Device SEP ID.[XXXXXXXXXXXX]=MAC</label>
|
||||||
<input>
|
<input>
|
||||||
<name>mac</name>
|
<name>mac</name>
|
||||||
<default>000000000</default>
|
<default></default>
|
||||||
<class>sccp-custom</class>
|
<class>sccp-custom</class>
|
||||||
|
<options></options>
|
||||||
</input>
|
</input>
|
||||||
<help>The MAC address of the phone. You must specify 12 characters in the format XXXX.XXXX.XXXX or XX-XX-XX-XX-XX-XX or XXXXXXXXXXXX</help>
|
<help>The MAC address of the phone. You must specify 12 characters in the format XXXX.XXXX.XXXX or XX-XX-XX-XX-XX-XX or XXXXXXXXXXXX</help>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1282,7 +1283,7 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
<label>Device SEP ID</label>
|
<label>Device SEP ID</label>
|
||||||
<input>
|
<input>
|
||||||
<name>mac</name>
|
<name>mac</name>
|
||||||
<default>000000000</default>
|
<default></default>
|
||||||
<class>sccp-custom</class>
|
<class>sccp-custom</class>
|
||||||
<options readonly="readonly"></options>
|
<options readonly="readonly"></options>
|
||||||
</input>
|
</input>
|
||||||
|
|
Loading…
Reference in a new issue