Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Events on textfield not firing #6

darrenloasby opened this Issue Oct 10, 2011 · 3 comments


None yet
2 participants

Hi there

I have noticed that when creating a view hierarchy using the K({ }) syntax, events attached to a textfield (such as "change", "return", "focus" etc.) don't fire.

if you try a click event on a label however it does work, as is demonstrated in the example docs.

Is this a known limitation or a bug? If it's the former I am happy to fork and dig around and try and fix this up.

PS: I'm really enjoying playing with Kranium. It's a very well thought-out toolkit for making the painful task of interface building with Titanium a little bit more pleasant and productive. Snaps to the devs.


krawaller commented Oct 10, 2011


I believe your problem arises due to lousy documentation. If you set a function to the click property of an element, it will be automatically bound. However this behaviour only applies to the click property - all other events have to be set in an object on the events property to be automatically bound.

Also, in this events object, you can specify another object on the app property. All functions found here will be bound to the global app events, but called upon the element. Example time!

    type: 'window',
    children: [{
        type: 'label',
        top: 10,
        width: 200,
        height: 20,
        text: 'Click me!',
        click: K.log
        type: 'textfield',
        top: 40,
        width: 200,
        height: 40,
        click: K.log,
        hintText: 'enter text please',
        events: {
            change: K.log,
            'return': K.log,
            app: {
                customglobalevent: K.log

Hope this helps, and big thanks for the heads up and flattery!

Amazing. Thank you so much for your work, and rapid and concise assistance!


krawaller commented Oct 10, 2011

You're most welcome!

Sorry about the somewhat lousy documentation and examples. I'll definitely have to make these things much more clear. If any of you have any ideas about how, or would like to fork away and add your take on it, please do, or let me know what I can do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment