Template events with jqueryui dialog


#1

hi,

I’m trying to make an jqueryui dialog form and get the events.
here is my code :

the template :

<template name="display_login_info">
<div id="display_login_info" title="Connection invité" style="display:none">
    <p>Vous êtes indentifié comme invité.</p>
    <p>Votre nom : {{username}}</p>
    <form>
        Changez de nom :
        <input type="text" name="name" id="name" value="{{username}}" class="text ui-widget-content ui-corner-all">
        <button>ok</button>
        <input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
    </form>
</div>

and the js file :

Template.display_login_info.helpers({
username : function () { return Meteor.user().username; }
});

Template.display_login_info.onRendered(function () {
    $('button').button();
    $('#display_login_info').dialog({
        width: 350,
        modal: true,
        buttons: {
            "Se connecter" : function() {
                dialog.dialog( "close" );
            },
            "Continuer" : function() {
                dialog.dialog( "close" );
            }
        }
    });
    $('#name').change( function () {console.log('coucou jquery');})
});

Template.display_login_info.events({
    'change #name' : function (event) {
        console.log('coucou blaze');
        event.preventDefault();
    }
});

and when I change something in the input i have “coucou jquery” but not “coucou blaze”.
I would like use only Template.display_login_info.events is it possible ?

thanks
karda