Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDD97-Webprog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Oliver Green
TDDD97-Webprog
Commits
97fc6636
Commit
97fc6636
authored
2 years ago
by
Oliver Green
Browse files
Options
Downloads
Patches
Plain Diff
starting inputvalidation of form
parent
903e59f6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client.css
+0
-0
0 additions, 0 deletions
client.css
client.html
+66
-1
66 additions, 1 deletion
client.html
client.js
+36
-1
36 additions, 1 deletion
client.js
with
102 additions
and
2 deletions
welcome
.css
→
client
.css
+
0
−
0
View file @
97fc6636
File moved
This diff is collapsed.
Click to expand it.
client.html
+
66
−
1
View file @
97fc6636
...
...
@@ -3,7 +3,72 @@
<link
href=
"client.css"
type=
"text/css"
rel=
"stylesheet"
>
<script
src=
"client.js"
type=
"text/javascript"
></script>
<script
src=
"serverstub.js"
type=
"text/javascript"
></script>
<script
type=
"text/view"
id=
"welcomeview"
>
<
div
class
=
"
welcome
"
>
<
img
src
=
"
wimage.png
"
alt
=
"
logo and slogan
"
>
<
div
class
=
"
form-elements
"
id
=
"
login
"
>
<
form
id
=
"
loginform
"
onsubmit
=
"
return inputValidation()
"
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
email
"
>
Email
<
/label
>
<
input
type
=
"
text
"
id
=
"
email
"
name
=
"
email
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
password
"
>
Password
<
/label
>
<
input
type
=
"
text
"
id
=
"
password
"
name
=
"
password
"
size
=
"
18
"
>
<
/div
>
<
input
type
=
"
submit
"
value
=
"
Login
"
>
<
/form
>
<
form
id
=
"
signupform
"
onsubmit
=
"
return inputValidation()
"
>
<
h2
>
Sign
up
here
<
/h2
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
fname
"
>
First
name
<
/label
>
<
input
type
=
"
text
"
id
=
"
fname
"
name
=
"
fname
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
lname
"
>
Family
name
<
/label
>
<
input
type
=
"
text
"
id
=
"
lname
"
name
=
"
lname
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
gender
"
>
Gender
<
/label
>
<
select
id
=
"
gender
"
name
=
"
gender
"
style
=
"
width:169;
"
>
<
option
value
=
"
male
"
>
Male
<
/option
>
<
option
value
=
"
female
"
>
Female
<
/option
>
<
option
value
=
"
other
"
>
Other
<
/option
>
<
/select
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
city
"
>
City
<
/label
>
<
input
type
=
"
text
"
id
=
"
city
"
name
=
"
city
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
country
"
>
Country
<
/label
>
<
input
type
=
"
text
"
id
=
"
country
"
name
=
"
country
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
email
"
>
Email
<
/label
>
<
input
type
=
"
text
"
id
=
"
email
"
name
=
"
email
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
password
"
>
Password
<
/label
>
<
input
type
=
"
text
"
id
=
"
password
"
name
=
"
password
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
label
for
=
"
password2
"
>
Repeat
PSW
<
/label
>
<
input
type
=
"
text
"
id
=
"
password2
"
name
=
"
password2
"
size
=
"
18
"
>
<
/div
>
<
div
class
=
"
form-input
"
>
<
input
type
=
"
submit
"
value
=
"
Sign Up
"
>
<
/div
>
<
/form
>
<
/div
>
<
/div
>
</script>
</head>
<body>
<body
style=
"background-color: antiquewhite;"
>
<div
id=
"pagecontent"
>
</div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
client.js
+
36
−
1
View file @
97fc6636
...
...
@@ -6,4 +6,39 @@ window.onload = function() {
// You shall put your own custom code here.
// window alert() is not allowed to be used in your implementation.
//window.alert("Hello TDDD97!");
};
\ No newline at end of file
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
welcomeview
"
).
innerText
;
var
signupform
=
document
.
forms
[
"
signupform
"
]
signupform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
inputValidation
(
event
);
})
};
inputValidation
=
function
(
event
)
{
let
allInputs
=
document
.
forms
[
"
signupform
"
].
elements
;
for
(
elem
in
allInputs
)
{
if
(
element
.
type
===
"
text
"
&&
element
.
value
===
""
)
{
console
.
log
(
"
hejejeheh
"
);
return
false
;
}
}
let
emailText
=
document
.
forms
[
"
loginform
"
][
"
email
"
].
value
;
if
(
!
validateEmail
(
emailText
))
{
return
false
;
}
}
function
validateEmail
(
input
)
{
var
validRegex
=
/
\w
+@
\w
+
\.\w
+/
if
(
input
.
value
.
match
(
validRegex
))
{
alert
(
"
Valid email address!
"
);
document
.
form1
.
text1
.
focus
();
return
true
;
}
else
{
alert
(
"
Invalid email address!
"
);
document
.
form1
.
text1
.
focus
();
return
false
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment