title: jquery dialog submit form in iframe
body: <p>I'm using jquery to open a dialog containing an iframe (don't ask!). I want to submit the form in the iframe on closing the dialog but it isn't working.</p>
  
  <p>I'm probably making a simple error (I'm quite new to jquery) but this problem has been driving me round the bend.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    $(function() {
  
      $( "#iframe" ).dialog({
          modal: true,
          autoOpen: false,
          height: 500,
          width: 700,
          buttons: {
              "Save and close": function() {
                  $( "#iframe").contents().find("#contentform").submit();
                  $( "#iframe" ).dialog( "close" );
              },
              Cancel: function() {
                  $( "#iframe" ).dialog( "close" );
              }
          }
      });
  
      $( "#openProfile" ).click(function() {
          $( "#iframe" ).dialog( "open" );
          $('#iframe').attr('src','file.asp');
          return false;
      });     
  });
  </code></pre>
  
  <p>However, if I do this instead of submitting the form: </p>
  
  <pre><code>"Save and close": function() {
  var myformvalue = $( "#iframe").contents().find("#formfield").val();
  alert(myformvalue);
  $( "#iframe" ).dialog( "close" );
  }
  </code></pre>
  
  <p>...it returns the correct value so I know it is recognising my form and its values.</p>
  
  <p>Thanks in advance for your help.</p>