You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Fermin Da Costa Gomez <da...@dcgconsultancy.nl> on 2009/10/13 21:53:18 UTC
Auto expanding field
Hi,
Whilst working on a google-like search i decided i wanted 'my old expanding
inputfield' back.
It is pretty insignificant but you hardly ever come across them, despite the
fact that they can be quite usefull imho .. ;-)
Just thought i would drop it on the list. It can probably be improved upon
but it works ..
...
<script type="text/javascript" language="JavaScript">
<!-- //
// Toggle the display of a set of elements between show and hide
function widenField(currentField) {
if (currentField.value.length >= (currentField.size-1)) {
currentField.size =
currentField.value.length+1;//currentField.maxLength + 2;
}
}
//-->
</script>
...
...
<input t:id="fieldName" t:type="TextField" t:mixins="autocomplete"
t:minChars="1" t:frequency="0.15" *onKeyPress="widenField(this)*"/>
...