Revision history [back]

click to hide/show revision 1
initial version

answered 2013-09-09 08:21:03 +0800

benbai gravatar image benbai

http://www.zkoss.org

Please refer to below sample:

<zk xmlns:w="client">
    <textbox rows="4" cols="35">
        <attribute w:name="bind_"><![CDATA[
            function (a, b, c) {
                this.$bind_(a, b, c);
                var inp = this.getInputNode(),
                    $inp = jq(inp),
                    wgt = this;
                $inp.bind('input', function () {
                    // has scrollbar
                    if ((inp.scrollHeight - inp.offsetHeight) > 10) {
                        $inp.val(''); // clear scrollbar
                        $inp.val(wgt._latestAllowedValue);
                    } else {
                        wgt._latestAllowedValue = $inp.val();
                    }
                });
            }
        ]]></attribute>
    </textbox>
</zk>

Please refer to below sample:sample below:

<zk xmlns:w="client">
    <textbox rows="4" cols="35">
        <attribute w:name="bind_"><![CDATA[
            function (a, b, c) {
                this.$bind_(a, b, c);
                var inp = this.getInputNode(),
                    $inp = jq(inp),
                    wgt = this;
                $inp.bind('input', function () {
                    // has scrollbar
                    if ((inp.scrollHeight - inp.offsetHeight) > 10) {
                        $inp.val(''); // clear scrollbar
                        $inp.val(wgt._latestAllowedValue);
                    } else {
                        wgt._latestAllowedValue = $inp.val();
                    }
                });
            }
        ]]></attribute>
    </textbox>
</zk>
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More