Hi Jeremy, Yes, this is the way to make it working. In Wicket 1.5 all this is already improved and Wicket provides Number, Url and Range TextFields out of the box but it is quite easy to use the other types too. To make it work in 1.4.x you'll need to use the monkey-patch approach. You can see the history of https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/wicket-html5-parent/wicket-html5. There is a Behavior which did exactly this before the improvements in Wicket 1.5.
On Wed, Apr 27, 2011 at 1:50 AM, Jeremy Levy <[email protected]> wrote: > 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 > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
