Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
I have a Velocity template that is attempting to allow users to select multiple Project Categories;
<table cellpadding="2" cellspacing="2">
#foreach ($projectCategory in $projectCategories)
<tr>
<td><input type="checkbox" name="projectCategories" value="$projectCategory.getId()"
#if (${selectedProjectCategories})
#if (${selectedProjectCategories.contains($projectCategory.getId())})
CHECKED
#end
#end
></td>
<td>#displayConstantIcon ($projectCategory) $projectCategory.getName()</td>
</tr>
#end
</table>
By using the same "name" property for each checkbox, I can access all the selected ids from the parameters;
public Map<String, Object> getDescriptorParams(Map params) {
if (params != null && params.containsKey("projectCategories")){
return MapBuilder.build( "projectCategories", params.get("projectCategories"));
}
return MapBuilder.build( "projectCategories", new ArrayList<String>());
}
However, when I then extract these via the "FunctionDescriptor", the ArrayList is now a string and I am unable to access the original values;
functionDescriptor.getArgs().get("projectCategories")
Any ideas? To get around this I have had to use unique "name" properties prefixed with a common string, and then extract each entry in the params which has a key that starts with the common string. This really smells to me!
Thanks
Robbie