Thanks, I can't use onblur, for end-user it's more visual if the transformation is done when key are pressed instead when input is leaved. I also want to add a set of key control on keypress, to only allow a predefined set of key, or a regexp... and may be create a formattedtextfield later.

I'll wait for Signal update, thanks for the tips.

Beau Hartshorne a écrit :
Can't you just do a toUpperCase onblur? If you don't want to do that, you could do something like this:

<input id="upper" type="text" />

<script>
MochiKit.Signal.connect('upper', 'onkeyup',
    function(e) {
        var c = e.key().code;
        if (65 <= c && c <= 90) {
            var u = MochiKit.DOM.getElement('upper');
            var v = u.value.toUpperCase();
            u.value = v;
        }
    });
</script>

(This code will not work until I update Signal with a bugfix, check the trunk soon.)

On 14-Mar-06, at 10:25 PM, David Bernard wrote:

I would like to transform keypress event : eg apply a toUpperCase(),
then textfield are filled with only Upper Case without need for the  end
user to press shift or capslock.

Is it possible with MochiKit.Signal ? How ?



--------------------------------------------------------------
David "Dwayne" Bernard            Freelance Developer
                                  mailto:[EMAIL PROTECTED]
      \|/                         http://dwayneb.free.fr
--o0O @.@ O0o-------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to