This website works better with JavaScript.
Home
Explore
Help
Sign In
mh
/
mhsw-espurna
Watch
1
Star
0
Fork
0
Code
Releases
0
Activity
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
d2f2d9fce5
6cf55da375
commit
35d1d4046e
No known key found for this signature in database
GPG Key ID:
4AEE18F83AFDEB23
1 changed files
with
7 additions
and
2 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+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
;
}
Write
Preview
Loading…
Cancel
Save