SleepyCod
by SleepyCod

Restrict field input with Javascript and Swell

Posted in Javascript, Swell

Today, we are delivering the first page to play around with Swell and we are quite happy of the result. We wanted to show how easy it is to restrict the characters typed in form fields.

By using the universal selector (*) built-in Swell’s Event library, you can catch any keystroke and of course retrieve its text representation  in your event handler !

Be careful the code behind the Event library is still in early Alpha stage and far from being production ready, have fun !

Restrict input chars playground page

Tags: ,

2 Responses to “Restrict field input with Javascript and Swell”

  1. 1
    MagicalTux Says:

    Hey guys!
    Found a bug with your system: when you are blocking a keypress (for example) you are indeed blocking it, however when a key is down, if it does not go up, at some point there will be repetition… and it’s not blocked!
    Just keep a key pressed and you can type whatever you want~

  2. 2
    SleepyCod Says:

    @MagicalTux

    Thanks for reporting, we’ll grant you access to our bug tracker so you’ll be able to provide a complete description of the problem as well as your testing environment.

Leave a Reply