jQuery UI modal dialog form using remote content

I have a form in a web page dynamically generated and I would like to display it using a the jQuery UI modal dialog.

How can I display the modal dialog form with the remote existing form (myform.html) as content when I click on a link "Open Form"? Clicking on submit button should close the dialog form.

Answers


This will load the content of myform.html into the element with ID formContainer, make the formContainer a modal dialog (showing the form). When submitting the form, the dialog will be closed

$("#formContainer").load("myform.html", function() {
    var container = $(this);
    container.dialog({
        modal: true
    })
    .find("form").submit(function() {
        container.dialog("close");
        return false;
    });
});

Need Your Help

Chain as recipient of a recipient-list-router

java spring spring-integration

Can I use a router in a chain? Practically the recipient of the router should be a chain.

How can I prevent automatic form submission by bots?

coldfusion captcha coldfusion-6

I am running ColdFusion MX, so I don't have the possibility of using the built-in cfimage Captcha functionality in my application, before form submitting.