Wicket DateTimeField - trick for young players

If, like me, you tried to use the DateTimeField component in the Wicket extensions library and saw an extra spurious TextField appear in your form and you didn't know why... then read on:

It turns out that the DateTimeField is actually rendered as a Panel by Wicket. Being a field in a Form I naturally (according to what I saw in some online example code) just entered markup within my form like this:


<input type="text" id="startDate">


but of course that can't work. Wicket can't render a panel into an input element (well not with any success at least!).

It turns out that as a Panel the DateTimeField is best entered as a <div> in your markup:



<div id="startDate" />



That allows the DateTimeField to be rendered correctly. Yeehah!

Once again I want to congratulate the Wicket team on the world's best object oriented, component based, Java User Interface framework.... a big claim I know, but try it and I think you'll agree!

Comments

Popular posts from this blog

Java package name structure and organization - best practice and conventions

Classic software engineering mistakes: To Greenfield or Refactor Legacy code?

How to reset MySQL 8 root password on CentOS 7 and 8