Browse Source

Merge pull request #1035 from mcspr/alert-haschanged

Don't show alert on already set hostname
v2
Xose Pérez 6 years ago
committed by GitHub
parent
commit
35d1d4046e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      code/html/custom.js

+ 7
- 2
code/html/custom.js View File

@ -176,8 +176,13 @@ function validateForm(form) {
var re_hostname = new RegExp('^(?!-)[A-Za-z0-9-]{0,31}[A-Za-z0-9]$');
var hostname = $("input[name='hostname']", form).val();
if (!re_hostname.test(hostname)) {
var hostname = $("input[name='hostname']", form);
var hasChanged = hostname.attr("hasChanged") || 0;
if (0 === hasChanged) {
return true;
}
if (!re_hostname.test(hostname.val())) {
alert("Hostname cannot be empty and may only contain the ASCII letters ('A' through 'Z' and 'a' through 'z'), the digits '0' through '9', and the hyphen ('-')! They can neither start or end with an hyphen.");
return false;
}


Loading…
Cancel
Save