Loading content from remote page into ui dialog - problem!

Loading content from remote page into ui dialog - problem!

I'm an newbie to jQuery, so sorry, if I sound stupid...

My problem: I have a form, that I validate with this engine , and as long as I put this form into a div and call with

  1. $(''#testDiv').dialog();
everything is fine. Submitting with UI-button and validation work as expected.


But if I call my div with the containing form from a remote page with

  1. $('.edit').each(function() {
            var $link = $(this);
            var $dialog = $('<div></div>')
                .load($link.attr('href'))
                .dialog({
                    autoOpen: false,
                    modal: true,
                    title: $link.attr('title'),
                    width: 600,
                    height: 600,
                    buttons: {
                        'Abbrechen': function() {
                            $(this).dialog('close');
                        },
                        'Eintragen': function() {
                            $('#testForm).submit();
                            
                        },
                    }

                });

            $link.click(function() {
                $dialog.dialog('open');

                return false;
            });
        });


























something goes wrong.

Submitting the form only works with $('form#testForm).submit(); notice the additional 'form' in front of the form ID), and the tooltips from the validation engine are not displayed at the input field, but on the left browser border. You can see it on this screenshot:

Tooltips on their way to freedom

Valdiation doesn't work correctly anymore, matching fields are validated as not matching. Another screenshot:



So my guess is, that the code I use to call my form into the dialog from a remote page does something different than just producing a div and calling it into a dialog on demand...

Anyone who can help me? I've been working on this for three days now (I'm terrible with javascript...), and any help is highly appreciated!!

Thanks in advance!