昔、Wicket 1.5 の頃は、
<input type="search" に対して、TextField<String> の代わりに、TextArea<String> を使用することで対応できた。
今の Wickrt8 ではこれはダメだ。
TextField<String> で、<input type="search" は、
must be applied to a tag with [type] attribute matching any of [text], not [search]
のエラーになる。
Chrome でも、IE や Edge のように、<input type="search" > を使用したい。
つまり、
フォーカスが当たって、
キー入力したら、、
と入力文字をクリアする「×」が出てくるいわゆる type="search" のフィールドにしたいのだ。
しかたなく、jQuery で対応する。
$("input[type='text']").focus(function(eo){ $(this).prop('type','search'); }).blur(function(eo){ $(this).prop('type','text'); });
これで無理やりフォーカスが当たったら、type="search" にして
フォーカスがはずれたら元に戻す。
<input wicket:id="item" id="item" type="text">
なら、
$("#item").focus(function(eo){ $(this).prop('type','search'); }).blur(function(eo){ $(this).prop('type','text'); });
そういえば昔、
oboe2uran.hatenablog.com
なんて書いていたな。。。。