Form data missing when automatically submit the form

Hi,

I want to submit a form(CActiveForm) automatically when a popup window is closed. But the form data is missing so it could not pass the form validation.

I use the following jquery function to enable the auto-submission:





<script type="text/javascript">

$(document).ready(function(){

	$('#aDialog').dialog({

		modal: true,

		buttons:[{

			text: 'Ok',

			click: function(){

                                //......

				$(this).dialog('close');

			}

		}],

		close: function(evt, ui){

			$('#parentFormId').submit();

		}

	});

});

</script>



Could anyone help pls? Thanks

Are you sure that the submit action completes before the window is closed? Try putting a callback on the submit function, http://api.jquery.com/submit/ to see if submission is finalised.

The form has been submitted after the popup window is closed. And if I check a field value by

$("#parentFormId").submit(function() {

 alert(&#036;('#fieldID select').val());


 return true;

});

I could see the field value is there.