diff --git a/WebContent/WEB-INF/jsp/events.jsp b/WebContent/WEB-INF/jsp/events.jsp index 3fda386307..919977eb39 100644 --- a/WebContent/WEB-INF/jsp/events.jsp +++ b/WebContent/WEB-INF/jsp/events.jsp @@ -118,20 +118,43 @@ // var x = dojo.widget.byId("datePicker"); // console.log(x); // x.setDate(x.today); - time = new Date($("datePicker")); - - + time = new Date($("datePicker")); + hideContextualMessages("eventSearchForm"); // doSearch(0,time.getTime()); console.log("newSearch"); - if(!isValid(eventId.value)) { - $set("searchMessage", $get("eventIdLabel") + " - Incorrect input data type"); - } else if(!isValid(maxResults.value)) { - $set("searchMessage", $get("maxResultsLabel") + " - Incorrect input data type"); + + let searchConfigTemp = createSearchConfigTemp(); + + let messages = validateSearchParameters(searchConfigTemp); + + if(messages.length > 0) { + showDwrMessages(messages); } else { doSearchOld(); } } + function createSearchConfigTemp(){ + let searchConfig = {} + searchConfig.eventId = $get("eventId"); + searchConfig.maxResults = $get("maxResults"); + return searchConfig; + } + + function validateSearchParameters(parametersToCheck){ + let messages = []; + + if (!isValid(parametersToCheck.eventId)) { + let message = createValidationMessage("eventId", ""); + messages.push(message); + } + if(!isValid(parametersToCheck.maxResults)) { + let message = createValidationMessage("maxResults", ""); + messages.push(message) + } + return messages; + } + function silenceAll() { MiscDwr.silenceAll(function(result) { var silenced = result.data.silenced; @@ -170,7 +193,7 @@
-
+