Hello, my fellow jquery UI developers,

I am having trouble with binding 'keypress' event to an input field
for a form in a jquery ui dialog.
It seemed that when I type 'enter' in an input field, the whole page
is refreshed (which means the dialog disappeared completely).

Can somebody shed some light on this one?

thx in advance,



requestContactForm = function()
{
    $.ajax({
        type: "POST",
        url: "ajax/profile.ajax.php",
        data: dataString,
        success: function(data){
            $dialog = $("#dialog");
            $dialog.html(data).dialog({
                title: '编辑联系方式',
                bgiframe: true,
                open: onEnterSubmitContactForm, // this is where i
register the event.
                modal: true,
                height: 400,
                width: 500,
                buttons: {
                    'Submit': function(){
                        d6w.fl.fn.submitContactForm(formType, id);
                    },
                    'Cancel': function(){
                        $(this).dialog('destroy');
                        $("#dialog").html('');
                    }
                }
            }).show();
        }
    });
};



onEnterSubmitContactForm = function(){
    alert("i need to be here.");
    $('input').keypress(function(e){
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode ==
13)) {
            submitContactForm(formType, id);
        }

        return false;
    });
};


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to