Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
9.16.0, 10.0.0, 9.17.0
-
None
Description
Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is broken.
Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:
[...]
* the current text value will be in variable 'input'.
*
* If the function returns <code>null</code> the chosen text value will be ignored.
* <p/>
* example 1:
*
* <pre>
* protected CharSequence getOnSelectJavaScript(Address address)
* {
* final StringBuilder js = new StringBuilder();
* js.append("wicketGet('street').value ='" + address.getStreet() + "';");
* js.append("wicketGet('zipcode').value ='" + address.getZipCode() + "';");
* js.append("wicketGet('city').value ='" + address.getCity() + "';");
* js.append("input"); // <-- do not use return statement here!
* return js.toString();
}}
* </pre>
[...]
wicket-autocomplete.js source:
function handleSelection(input) {
var attr = getSelectableElement(selected).attributes.onselect;
return attr ? eval(attr.value) : input;
}
Minified wicket-autocomplete.min.js, 9.7.0:
function handleSelection(input){var attr=getSelectableElement(selected).attributes.onselect;return attr?eval(attr.value):input}
Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 10.0.0:
function O(d){var a=J(p).attributes.onselect;return a?eval(a.value):d}
There is no "input" parameter anymore. Minification is too aggressive and breaks this functionality, which only happens in production, since in development the non-minimized source JS files will be used.
Workaround: set Application.get().getResourceSettings().getUseMinifiedResources() to false when deploying into production.