I have a block of code I use to manage all dialogs on my site. For
every dialog I want a "submit" and "close" button. To put the
following code into context, I call a dialog by writing something
like:
<a href="index.cfm?page=whatever" class="dialog" name="{width:
200,height:300,title:'Test'}">open dialog</a>
the code looks like this:
$(".dialog").live("click", function(){
// config exists in elements name attribute in JSON format.
var config = (this.name.length) ? eval('(' + $(this).attr("name") +
')') : {};
var params = (config.params) ? config.params : {};
var w = parseInt(config.width) || 500;
var h = parseInt(config.height) || 400;
var title = config.title || "AtlanticPanic.com";
var d = $('<div id="dialog">Loading...</div>').appendTo("body");
d.load( $(this).attr("href")+"&ajax=true", params )
.dialog({width:w,
height:h,
title:title,
close:function(ev,ui){ $(this).remove(); },
buttons:{
"Close":function(){ $(this).dialog("close");},
"Submit":function(){ $(this).find("form").submit(); }
}
})
.dialog("open");
return false;
});
The problem is that the submit button does not submit the form because
of the return false; statement at the end of the code. If I remove
it, all works fine, but I need to keep it in there because the class
"dialog" is binded to anchor elements. Even
if I put "return true" after the .submit() call it does not work. Can
someone help me refactor this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---