diff --git a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java index dbb21d3a3a8111104b0801b1b12b4a16e5b2403f..4e25da2a13d2d1cdc459db3fd6facae099d99bc9 100644 --- a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java +++ b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java @@ -31,10 +31,10 @@ public class organisationControllers { } @Autowired private localAuthorityRepository localAuthorityRepository; - @PostMapping("/local-auth-data1") + @PostMapping("/local-auth-data") public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) { if (bindingResult.hasErrors()){ - ModelAndView modelAndView = new ModelAndView("local-auth-data1", model.asMap()); + ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap()); return modelAndView; }else{// converts user input using the organisation constructor into a submittable format to the sql table diff --git a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java index 3a07cde4912861b3ff3a3dade143b079fb3f221b..7bed36b9c48f30b5fc903616bb587cde6d9399f8 100644 --- a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java +++ b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java @@ -19,7 +19,7 @@ public class localAuthority { private URL website; @Override public String toString() { - return "localAuthority{" + + return "localAuthority" + localAuthorityName + '\'' + address1 + '\'' + address2 + '\'' + @@ -27,16 +27,14 @@ public class localAuthority { county + '\'' + postcode + '\'' + website + - '}'; + '.'; } public String getLocalAuthorityName() { return localAuthorityName; } - public String getAddress1() { - return address1; - } + public String getAddress1() { return address1; } public String getAddress2() { return address2; diff --git a/src/main/resources/templates/local-auth-data.html b/src/main/resources/templates/local-auth-data.html index dd217e1fb3643145f8968ed3fb9a2f0928d34ba0..3a3dd6098bd0739bdd960f5c31d553e0eaf4af6a 100644 --- a/src/main/resources/templates/local-auth-data.html +++ b/src/main/resources/templates/local-auth-data.html @@ -11,30 +11,30 @@ <body> <div id="container1"> <h2>Enter your Local authority</h2> - <form action="/local-auth-data1" id="data" name="data" method="post"> + <form action="/local-auth-data" id="data" name="data" method="post" th:object="${localAuthority}"> <br> - <label for="localAuthorityName">Enter your local authority - <input type="text" field="localAuthorityName" name="authority_name" id="localAuthorityName"> + <label>Enter your local authority + <input type="text" th:field="*{localAuthorityName}"> </label><br><br> - <label for="address1">Please enter first line of your address - <input type="text" name="address_1" id="address1"> + <label>Please enter first line of your address + <input type="text" th:field="*{address1}"> </label><br><br> - <label for="address2">Please enter second line of your address (optional) - <input type="text" name="address_2" id="address2"> + <label>Please enter second line of your address (optional) + <input type="text" th:field="*{address2}"> </label><br><br> - <label for="city">Please enter the City/Town - <input type="text" name="city" id="city"> + <label>Please enter the City/Town + <input type="text" th:field="*{city}"> </label><br><br> - <label for="county">Please enter you county (optional) - <input type="text" name="county" id="county"> + <label>Please enter you county (optional) + <input type="text" th:field="*{county}"> </label><br><br> - <label for="postcode">Please enter your postcode - <input type="text" name="post_code" id="postcode"> + <label>Please enter your postcode + <input type="text" th:field="*{postcode}"> </label><br><br> - <label for="website">Please enter your website address - <input type="url" name="web_site" id="website"> + <label>Please enter your website address + <input type="text" th:field="*{website}"> </label><br><br> - <input type="submit" value="Submit"> + <input type="submit"> </form> </div> </body> diff --git a/src/main/resources/templates/local-authorities.html b/src/main/resources/templates/local-authorities.html index ecf80b64688cf9fc7f72ac8a25b0bc2fb1fe2e80..e416d25fdf393d697deed2f94651369127b86e91 100644 --- a/src/main/resources/templates/local-authorities.html +++ b/src/main/resources/templates/local-authorities.html @@ -10,8 +10,8 @@ <body> <h1>Local Authorities</h1> <div id="councils"> - <ul th:each="localauthorities:${localAuthority}"> - <li th:text="${localauthorities}"></li> + <ul th:each="localAuthority:${localAuthority}"> + <li th:text="${localAuthority}"></li> </ul> </div> <a href="/localForm" id="authority"><button>Local Authorities please enter here</a></button>