セレクトボックスに日付(年、月、日)開始時刻の分は選べるようになっているのですが、
開始時と終了時刻時、分は選べなくなっています。
試していますが、解決しません。
<html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8" /> <title>日誌登録</title> </head> <h1>日誌登録</h1> <form th:action="@{/teacher-nissi-conf}" th:object="${insertMogipuroForm}" > <p>※ は入力必須です。</p> <table class="table .thead-dark th "> <tr> <td>園児番号</td> <td><input type="text" th:field="*{id}" maxlength="4" th:errorclass="error-input" /></td> </tr> <tr> <td>園児氏名</td> <td><input type="text" th:field="*{name}" maxlength="20" th:errorclass="error-input" /></td> </tr> <tr> <td>記入者</td> <td><input type="text" th:field="*{daybookwriter}" maxlength="20" th:errorclass="error-input" /></td> </tr> <tr> <td>日付</td> <td> <select th:field="*{year}"> <option th:each="year :*{yearList}" th:value="${year}" th:text="${year}"></option> </select>年 <select th:field="*{month}"> <option th:each="month : *{monthList}" th:value="${month}" th:text="${month}"></option> </select>月 <select th:field="*{day}"> <option th:each="day : *{dayList}" th:value="${day}" th:text="${day}"></option> </select>日 </td> </tr> <tr> <td>開始時刻</td> <td> <select th:field="*{starttime}"> <option th:each="startime : *{startTimeList}" th:value="${starttime}" th:text="${starttime}"></option> </select>時 <select th:field="*{startmin}"> <option th:each="startMin : *{startMinList}" th:value="${startMin}" th:text="${startMin}"></option> </select>分 </td> <tr> <td>終了時刻</td> <td> <select th:field="*{endtime}"> <option th:each="endtime : *{endTimeList}" th:value="${endTime}" th:text="${endTime}"></option> </select>時 <select th:field="*{endmin}"> <option th:each="endmin : *{endMinList}" th:value="${endMin}" th:text="${endMin}"></option> </select>分 </td> </tr> <tr> <td>機嫌</td> <td><input type="text" th:field="*{mood}" th:errorclass="error-input" /> </td> </tr> <tr> <td>排便</td> <td><input type="text" th:field="*{poop}" th:errorclass="error-input" /> </td> </tr> <tr> <td>食事</td> <td><input type="text" th:field="*{meal}" th:errorclass="error-input" /> </td> </tr> <tr> <td>様子</td> <td><textarea name="movie" rows="20" cols="30"></textarea></td> </tr> <tr> <tr> <td>連絡事項</td> <td> <textarea name="communication" rows="2" cols="60"></textarea></td> </tr> </table> <input type="submit" name="nissi_btn" value="登録確認" /> <input type="submit" name="back_btn" value="戻る" /> </form> </html> ``` ``` import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; public class InsertMogipuroForm { private String id; @NotEmpty private String name; @NotNull private String classs; @NotNull private String sleepstarttime; private String sleependtime; @NotEmpty private String mood; @NotEmpty private String poop; @NotEmpty private String meal; @NotEmpty private String phase; //検索けんさくリスト private String searchid; private String searchstartyear; private String searchstartmonth; private String searchstartday; private String searchendyear; private String searchendmonth; private String searchendday; private String teachersellectid; private String serchtimelyid; private String serchid; private String pickuptime; private String communication; private String daybookwriter; private String writedate; private String childrenid; private String childrenname; private String timelywriter; private String year; private String month; private String day; private String startmin; private String endtime; private String endmin; private String starttime; private List<String> yearList; private List<String> monthList; private List<String> dayList; private List<String> startTimeList; private List<String> startMinList; private List<String> endTimeList; private List<String> endMinList; // private String InsertMogipuroForm() { id = ""; name = ""; classs = ""; sleepstarttime = ""; sleependtime = ""; mood = ""; poop = ""; meal = ""; phase = ""; pickuptime = ""; communication = ""; daybookwriter = ""; writedate = ""; childrenid = ""; childrenname = ""; timelywriter = ""; searchid = ""; year = ""; day = ""; startmin = ""; endmin = ""; yearList = new ArrayList<String>(); Calendar cl = Calendar.getInstance(); int year = cl.get(Calendar.YEAR); yearList.add(""); for (int i = year; i <= year + 3; i++) { yearList.add(String.valueOf(i)); } // month list monthList = new ArrayList<String>(); monthList.add(""); for (int i = 1; i <= 12; i++) { monthList.add(String.valueOf(i)); } // day list dayList = new ArrayList<>(); dayList.add(""); for (int i = 1; i <= 31; i++) { dayList.add(String.valueOf(i)); } // startTimeList 開始[時] startTimeList = new ArrayList<String>(); startTimeList.add(""); for (int i = 0; i <= 24; i++) { startTimeList.add(String.valueOf(i)); } // startMinList 開始[分] startMinList = new ArrayList<String>(); startMinList.add(""); for (int i = 0; i <= 59; i++) { startMinList.add(String.format("%02d", i)); } // endTimeList 終了[時] // endTimeList 終了[時] endTimeList = new ArrayList<String>(); endTimeList.add(""); for (int i = 10; i <= 18; i++) { endTimeList.add(String.valueOf(i)); } // startMinList 終了[分] endMinList = new ArrayList<String>(); endMinList.add(""); for (int i = 0; i <= 59; i++) { endMinList.add(String.format("%02d", i)); } } public String getId() { ``` ``` @RequestMapping(value = "/teacher-nissi-input", params = "nissi_btn") public String teacherNissiInput(@ModelAttribute("InsertMogipuroForm") InsertMogipuroForm form) { return "db/teacherNissiInput"; } ```
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。