Skip to content

Commit

Permalink
Merge pull request #2899 from SCADA-LTS/fix/#2845_Fixed_message_valid…
Browse files Browse the repository at this point in the history
…ation_in_event_search

#2845 Fixed message validation in event search
  • Loading branch information
Limraj authored Jun 21, 2024
2 parents 4c38bf6 + 3a79d78 commit a9ff78d
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions WebContent/WEB-INF/jsp/events.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<fmt:message key='badIntegerFormat'/>");
messages.push(message);
}
if(!isValid(parametersToCheck.maxResults)) {
let message = createValidationMessage("maxResults", "<fmt:message key='badIntegerFormat'/>");
messages.push(message)
}
return messages;
}
function silenceAll() {
MiscDwr.silenceAll(function(result) {
var silenced = result.data.silenced;
Expand Down Expand Up @@ -170,7 +193,7 @@
<div id="hourglass" style="padding:6px;text-align:center;"><tag:img png="hourglass"/></div>
</div>

<div class="borderDiv" style="clear:left;float:left;">
<div class="borderDiv" style="clear:left;float:left;" id="eventSearchForm">
<div class="smallTitle titlePadding"><fmt:message key="events.search"/></div>
<div>
<table>
Expand Down

0 comments on commit a9ff78d

Please sign in to comment.