[Laszlo-dev] For Review: Change 20071103-bargull-0 Summary: Add maxlength-support for multiline inputtexts (DHTML)
promanik at laszlosystems.com
Sat Nov 3 20:09:48 PDT 2007
Approved, but don't you need to make one change? For IE, you convert
\r\n to \n, but you don't convert it back after clipping the string.
I tried IE6 / IE7 / FF2 / Opera9 / Safari3.0.3PC
>Change 20071103-bargull-0 by bargull at dell--p4--2-53 on 2007-11-03
>18:09:41 in /home/Admin/src/svn/openlaszlo/trunk
>Summary: Add maxlength-support for multiline inputtexts (DHTML)
>LPP-4747 - "Edittext maxlength does not work"
>Technical Reviewer: max
>QA Reviewer: promanik
>Doc Reviewer: (pending)
>The HTML-<textarea> object does not support maxlength natively, so
>we need to implement a js-solution in DHTML.
>I've used the "onkeyup"-event to check the current text-length and
>if the length exceeds its limit and I simply re-assigning the value
>property of the <textarea> object. This approach does not give the
>best visual experience, because the maxlength-test does happen after
>the new input is already visible for the user. Alternatives to "onkeyup" are:
>"onkeydown" and "onkeypress".
>contra "onkeydown": we cannot determine which character the user
>enters, because we just have access to the "keyCode", which
>represents the pressed key on the keyboard (think about different
>contra "onkeypress": (sometimes,) we can determine which character
>the user enters. "sometimes" means, it's browsers-dependent. For
>example, IE and FF do give us this char-information (through "keyCode" resp.
>"charCode"), but no chance in Opera (I did test not Safari). Opera's
>handling is somehow "interesting": if you press a
>"alphanumeric"-key, you get the char-code through "keyCode", but if
>you press a "function"-key, you get the key-code through "keyCode"
>("charCode" is not supported in Opera). So it's almost the same
>problem as for "onkeydown", because we cannot easily determine which
>character was entered by the user.
>I am open for any suggestions for this changeset (i.e.: implement
>"onkeypress"-handling for IE/FF/?, and "onkeyup" for Opera/?). It'd
>be good to know how Safari handles this issue, because Safari is an
>A-list browser whereas Opera is just B-list.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Laszlo-dev