I have a form inside a dialog:
<div id="init_dialog" title="Information Required">
<form action="" method="post" id="init_form" onsubmit="return false;">
<input type="hidden" name="emp_pk" id="emp_pk" value="1234" />
<fieldset><legend>Information</legend>
<label for="init_info">Please Enter some information</label>
<input type="text" id="init_info" name="init_info" value="information" />
</fieldset>
</form>
</div>
In jquery:
jQuery(document).ready(function() {
jQuery('#init_dialog').dialog({
bgiframe:true,
autoOpen:false,
modal:true,
width:700,
buttons: {
Cancel:function(){ jQuery(this).dialog('close'); },
"Get Info":function(){ alert(jQuery('#init_form').serialize()); }
}
});
}
When I open the dialog and click the "Get Info" button (triggers the alert), I expect to see a string like this:
emp_pk=1234&init_info=information
Instead, I get a blank alert box.
I did a check with firebug and noticed that when the dialog is created, the <form> tags are completely stripped out. The demo on jqueryUI.com does NOT strip out the form tag. Am I missing something? This happens in both IE7 and Firefox 3.5
I'm using JqueryUI 1.7.2