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();
|
||||
});
|
||||
|
||||
$('#sccp_hw_mac').change(function() {
|
||||
$('#sccp_hw_mac').focus();
|
||||
|
||||
$('#sccp_hw_mac').focusout(function() {
|
||||
var value = $(this).val();
|
||||
const regex = new RegExp('^([0-9A-Fa-f]{2}[:.-]?){5}([0-9A-Fa-f]{2})$');
|
||||
if ( regex.test(value) === false ) {
|
||||
$('#ajaxsubmit2').attr('disabled', 'disabled');
|
||||
$('#ajaxsubmit').attr('disabled', 'disabled');
|
||||
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>
|
||||
<input>
|
||||
<name>mac</name>
|
||||
<default>000000000</default>
|
||||
<default></default>
|
||||
<class>sccp-custom</class>
|
||||
<options></options>
|
||||
</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>
|
||||
</item>
|
||||
|
@ -1282,7 +1283,7 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<label>Device SEP ID</label>
|
||||
<input>
|
||||
<name>mac</name>
|
||||
<default>000000000</default>
|
||||
<default></default>
|
||||
<class>sccp-custom</class>
|
||||
<options readonly="readonly"></options>
|
||||
</input>
|
||||
|
|
Loading…
Reference in a new issue