I am building a calendar within my struts2 application using fullcalendar. But... I am running into a bit of a problem. We have built an advanced search that allows us to filter the calendar events server side and return a result list. I am able to get most everything to work correctly with the exception of a select with multiple and I think it is because I am using my jquery wrong.
My ajaxLocationCalendar.action
is expecting to see a list of locations and not a string with multiple locations.
Within my code I have a <select id="locationsSelect" multiple="multiple">
which has several options.
My fullcalendar setup looks like the following:
events: {
url: 'ajaxLocationCalendar.action',
data: {
'scheduleableCriteria.approvalStatus': function() {
return $('#approvalStatusSelect').val();
},
'scheduleableCriteria.locations': function() {
return $('#locationsSelect').val();
}
}
}
The #approvalStatusSelect
works perfectly because there are 4 valid options and it is a single select. However I am having problems with the #locationSelect
.
If I select nothing I end up sending "null"
which is not a match to anything. If I select exactly one option I get a valid result because it is wrapped up correctly. If I try to send two selected I end up sending something like "Apartment,Building+3"
.
Is there a function other than .val()
that would allow me to send a list rather than what I am getting now?
Any help appreciated, if you need clarification put it in the comments and I will try to clarify more.