New window parameters disappear with validation fails

Hello all,
My 5th month with Ruby on Rails is over and on to #6, but still
learning.

I have an application…
Rails 2.3.5
Ruby 1.8.7

I have a jQuery dialog box that gives the user the option to “create” a
new project or “Cancel”.
When “Create New” is clicked, a new browser window is opened with the
“new” view display.
Everything works fine until I add validation to the form.
If a validation error occurs, the id that I passed disappears and the
data is lost.

Here’s the function call for the jQuery dialog box.

function createNewProject(irb_id){
jQuery.ui.dialog.defaults.bgiframe = true;
jQuery(function(){
jQuery(’#confirmDialog’).dialog({
title: ‘Create New Project’,
width: 225,
hide:{effect: ‘blind’, duration: 500},
resizable:false,
buttons:
{
‘Cancel’: function(){
jQuery(this).dialog(‘close’).dialog(‘destroy’);
window.location.reload(true);
},
‘Create New Project’: function(){
jQuery(this).dialog(‘destroy’);
jQuery.ajax({
type:‘GET’,
success: function(){
//redirect_to_newProject(irb_id);
jQuery(this).dialog(‘close’).dialog(‘destroy’);
removeRow(id);
removeProjectResults(id);
// open new browser window
window.open(’/projectdb/projects/new?id=’+irb_id,
‘New Project’,
‘left=20, top=20, width=1100, height=700, toolbar=0,
resizable=1, scrollbars=1’);
},
error: function(){
alert(‘error’);
}
}); //end ajax call
} // end of Confirm Link button
} // end buttons
}); // end jQuery dialog
}); // end jQuery function
}

I’m not sure what happens, but if I reload the window after the error
occurs, the data reappears.

Thank you for any help on this.

JohnM

When you’re “new” action fails, it moves to the “create” function
which simply renders the “new” view; it doesn’t call the “new” action
again…

So you’re loosing an ID? Is it part of the object your passing
through? It might be worth creating a hidden field to place the ID in