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
Don't show alert on already set hostname
v2
Maxim Prokhorov
6 years ago
parent
87859c5ad8
commit
6cf55da375
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