I've extended TextField to support some of the HTML5 variants, number, email
etc. This works great when submitting via normal methods. However it
doesn't work when using AjaxButton, the form data for the HTML5 fields is
never POSTed.
The root issue appears to be in wicket-ajax.js specifically lines 461-471
(Wicket 1.4.17):
// this function intentionally ignores image and submit inputs
Wicket.Form.serializeInput = function(input) {
var type = input.type.toLowerCase();
if ((type == "checkbox" || type == "radio") && input.checked) {
return Wicket.Form.encode(input.name) + "=" +
Wicket.Form.encode(input.value) + "&";
} else if (type == "text" || type == "password" || type == "hidden" ||
type == "textarea" || type == "search") {
return Wicket.Form.encode(input.name) + "=" +
Wicket.Form.encode(input.value) + "&";
} else {
return "";
}
}
As I understand this, basically the fields are ignored because they aren't
specifically handled in the code above... I've tested it by adding type
=="number" etc and that fixes the problem. I suppose my question is, is
this the right place to fix it, and if so what is the best way to override
this function, without having to do the whole js file?
J