0

I have a JQuery Modal Form and when i add the submit event, it cannot display as dialog but rather than embedded into browser window. If I uncomment the click event below, it will embedded into browser window rather than show as dialog.

$(document).ready(function(){

        //$("#moveTicketBtn").click() {
        //  $("#moveUnknownTicket").submit();
        //};


        $("#moveUnknownTicketDialog").dialog(
        {
            title: "Move Unknown Ticket",
            autoOpen: true,
            modal: true, 
            resizable: true, 
            stack: true, 
            width: 500, 
            height: 350 
        }); 




    });

Does anyone have any idea why it is like this? Please help. Thanks.

EDIT Question:

I have a form inside this dialog and upon submission(onsubmit, onblur) the javascript is not called. What is the reason?

1
  • I have a form inside this dialog and upon submission, the form event -> (onsubmit, onblur) does not called the javascript. What is the reason?
    – nicholas
    Commented Dec 6, 2012 at 4:01

2 Answers 2

2

try

$("#moveTicketBtn").click(function() {
  $("#moveUnknownTicket").submit();
});

you have to insert your function within the () of the click event.

more information here: http://api.jquery.com/click/

1
  • The .submit() method does not fire the onsubmit() event. Commented Dec 17, 2012 at 0:45
0

That should do the trick:

http://jsfiddle.net/uQCKJ/

As you can see the form is submitted, since the alert box is triggered

    $("#moveTicketBtn").click(function() {
    $("#moveUnknownTicket").submit();
});

I have put submit inside click function though works great.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.