Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2845 Fixed message validation in event search #2899

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#2845 Fixed message validation in event search
- Changed variables names for more appropriate
  • Loading branch information
Patrykb0802 committed Jun 21, 2024
commit 3a79d78984776d45bcbb691953389708b8aa9019
40 changes: 20 additions & 20 deletions WebContent/WEB-INF/jsp/events.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@
// var x = dojo.widget.byId("datePicker");
// console.log(x);
// x.setDate(x.today);
time = new Date($("datePicker"));
hideContextualMessages("eventSearchForm");
time = new Date($("datePicker"));
hideContextualMessages("eventSearchForm");
// doSearch(0,time.getTime());
console.log("newSearch");

let temp = createSearchFormConfigTemp();
let searchConfigTemp = createSearchConfigTemp();

let messages = validateSearchForm(temp);
let messages = validateSearchParameters(searchConfigTemp);

if(messages.length > 0) {
showDwrMessages(messages);
Expand All @@ -134,25 +134,25 @@
}
}

function createSearchFormConfigTemp(){
let searchForm = {}
searchForm.eventId = $get("eventId");
searchForm.maxResults = $get("maxResults");
return searchForm;
function createSearchConfigTemp(){
let searchConfig = {}
searchConfig.eventId = $get("eventId");
searchConfig.maxResults = $get("maxResults");
return searchConfig;
}

function validateSearchForm(searchForm){
let messages = [];
function validateSearchParameters(parametersToCheck){
let messages = [];

if (!isValid(searchForm.eventId)) {
let message = createValidationMessage("eventId", "<fmt:message key='badIntegerFormat'/>");
messages.push(message);
}
if(!isValid(searchForm.maxResults)) {
let message = createValidationMessage("maxResults", "<fmt:message key='badIntegerFormat'/>");
messages.push(message)
}
return 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() {
Expand Down
Loading