Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team 5 - Smart Towns
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rhys Evans
Team 5 - Smart Towns
Commits
e2da4480
Commit
e2da4480
authored
1 year ago
by
Rhys Evans
Browse files
Options
Downloads
Patches
Plain Diff
Styling for the form
parent
e9962cae
No related branches found
No related tags found
1 merge request
!13
Resolve "As a user I want to be able submit a form about a specific landmark to add to the trail"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java
+2
-1
2 additions, 1 deletion
.../java/Team5/SmartTowns/Landmarks/LandmarksController.java
src/main/resources/templates/Landmarks/LandmarkFormTh.html
+18
-21
18 additions, 21 deletions
src/main/resources/templates/Landmarks/LandmarkFormTh.html
with
20 additions
and
22 deletions
src/main/java/Team5/SmartTowns/Landmarks/LandmarksController.java
+
2
−
1
View file @
e2da4480
...
...
@@ -25,13 +25,14 @@ public class LandmarksController {
@PostMapping
(
"/landmarkSub"
)
public
ModelAndView
landmarkSent
(
@Valid
@ModelAttribute
(
"landmarkData"
)
Landmarks
landmarks
,
BindingResult
bindingResult
,
Model
model
)
{
System
.
out
.
println
(
landmarks
);
if
(
bindingResult
.
hasErrors
())
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"Landmarks/LandmarkFormTh.html"
,
model
.
asMap
());
return
modelAndView
;
}
else
{
System
.
out
.
println
(
landmarks
);
// LandmarksArray userArray = LandmarksArray.getInstance();
// Landmarks newUserSubmission = new Landmarks(landmarkData.getFormUsername(),userSubmission.getFormEmail(),
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/Landmarks/LandmarkFormTh.html
+
18
−
21
View file @
e2da4480
...
...
@@ -30,20 +30,21 @@
<body>
<header
th:insert=
"~{/towns/Templating.html :: header}"
></header>
<main>
<hr
style=
"height:40px; visibility:hidden;"
/>
<form
action=
"/landmarkSub"
id=
"landmarkSubmission"
name=
"landmarkSubmission"
method=
"post"
th:object=
"${landmarkData}"
onsubmit=
"return landmarkFormValidation()"
>
<br>
<label>
Business Name:
<input
type=
"text"
th:field=
"*{landmarkName}"
>
</label><br>
<br>
</label><br>
<div
th:errors=
"*{landmarkName}"
th:if=
"${#fields.hasErrors('landmarkName')}"
>
ErrorLandmarkName
</div>
<label>
Contact Address:
<br>
<label>
Contact Address:
<input
type=
"text"
th:field=
"*{landmarkEmail}"
>
</label><br>
<br>
</label><br>
<div
th:errors=
"*{landmarkEmail}"
th:if=
"${#fields.hasErrors('landmarkEmail')}"
>
ErrorEmail
</div>
<label>
Please Describe Your Business:
<br>
<textarea
th:field=
"*{landmarkDescription}"
rows=
"8"
cols=
"60"
></textarea>
<br>
<label>
Please Describe Your Business:
<br>
<textarea
th:field=
"*{landmarkDescription}"
rows=
"8"
cols=
"60"
placeholder=
"Max 200 words please..."
></textarea>
</label><br><br>
<label>
Your Location:
<!-- <input type="text" th:field="*{landmarkLocation}">-->
...
...
@@ -57,11 +58,11 @@
<label>
Trail:
<select
th:field=
"*{trailID}"
>
<option
value=
0
disabled
selected
>
Select Trail
</option>
<option
value=
1
>
(Caerphilly) Castle Trail
</option>
<option
value=
2
>
(Caerphilly) Pub Trail
</option>
<option
value=
3
>
(Caerphilly) Heritage Trail
</option>
<option
value=
4
>
(Caerphilly) Heritag
e Trail
</option>
<option
value=
5
>
(Caerphilly) Heritag
e Trail
</option>
<option
value=
010
1
>
(Caerphilly) Castle Trail
</option>
<option
value=
010
2
>
(Caerphilly) Pub Trail
</option>
<option
value=
010
3
>
(Caerphilly) Heritage Trail
</option>
<option
value=
0201
>
(Risca) Heritage and Cultur
e Trail
</option>
<option
value=
0301
>
(Penarth) Esplanad
e Trail
</option>
</select>
</label><br><br>
...
...
@@ -71,6 +72,7 @@
<hr
style=
"height:0px; visibility:hidden;"
/>
</form>
<hr
style=
"height:40px; visibility:hidden;"
/>
</main>
<script>
...
...
@@ -80,7 +82,6 @@
function
landmarkFormValidation
(){
// let element=document.getElementById("landmarkSubmission");
var
pass
=
true
;
var
trail
=
document
.
forms
[
"
landmarkSubmission
"
][
"
trailID
"
].
value
var
location
=
document
.
forms
[
"
landmarkSubmission
"
][
"
landmarkLocation
"
].
value
...
...
@@ -94,22 +95,18 @@
if
(
trail
==
0
){
alert
(
'
Invalid trail selected.
\n
Please select the trail you wish to join.
'
);
pass
=
false
;
}
else
{
trail
.
innerHTML
=
option
.
text
;
alert
(
trail
.
innerHTML
)
alert
(
'
a
'
)
}
if
(
location
==
0
){
if
(
location
==
""
){
alert
(
'
Invalid location selected.
\n
Please select the location you wish to join.
'
);
pass
=
false
;
}
if
(
trail
==
5
){
trail
.
value
=
29
;
}
if
(
(
location
==
"
Caerphilly
"
&
(
parseInt
(
trail
/
100
)
!==
1
))
||
(
location
==
"
Risca
"
&
(
parseInt
(
trail
/
100
)
!==
2
))
||
(
location
==
"
Penarth
"
&
(
parseInt
(
trail
/
100
)
!==
3
))
){
alert
(
'
Trail unavailable in your current location.
\n
Please choose an available trail
'
);
pass
=
false
;
}
return
pass
;
...
...
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