我在 JSF 中使用 jQuery Dialog 和 Ajax 提交时遇到问题。我有以下用于显示对话框窗口的代码:
<script type="text/javascript">
jQuery(function(){
// Dialog
jQuery('#dialog').dialog({
dialogClass: 'alert',
autoOpen: false,
width: 300,
height: 150,
modal: true,
resizable: false,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
"Ok": function() {
jQuery(this).dialog("close");
return true;
},
"Cancel": function() {
jQuery(this).dialog("close");
return false;
}
}
});
// Dialog Link
jQuery('#dialog_link').click(function(){
jQuery('#dialog').dialog('open');
return false;
})
.hover(
function() { jQuery(this).addClass('ui-hover-state'); },
function() { jQuery(this).removeClass('ui-hover-state'); }
);
});
</script>
It works as it should - it displays box when link is clicked.
Now, I have something like this, for deleting something:
<a4j:commandLink
actionListener="#some.action"
reRender="something"
onclick="if(!jQuery('#dialog').dialog('open')){return false}"
ok, this commandLink is rendered as follows:
<a href="#"
id="some:long:id:j_id338"
name="formName:something:j_id338"
onclick="if(!jQuery('#dialog').dialog('open')){return
false};A4J.AJAX.Submit('something:something');
return false;"
>drop</a>
现在,在显示对话框后,执行 A4j.AJAX.Submit(..),无论如何,我可以将整个 A4J.AJAX.Submit(...) 传递给“对话框”并执行它来自“确定”选项?当且仅当用户单击确定时,我只需要执行提交。谢谢JQ的帮助