Hi,
I am facing this problem for quite long time.
$(this).dialog('close') working fine first time but not second time.
I am using ajax, so there is no page refresh occurs. Until ajax call is successful dialog closing properly.
And once ajax call is made its not closing even if submit/save button is clicked.
Here is my code,
CODE:
jQuery.noConflict();
function submitDetails()
{
var inptUserName = document.getElementById('username').value;
var inptPassword = document.getElementById('password').value;
var inptFullname = document.getElementById('fullname').value;
var inptEmailId = document.getElementById('emailId').value;
var i = document.getElementById("selOptions").selectedIndex;
var selRoleType = document.getElementById("selOptions").options[i].value;
var url="editUsersAction.action?oper=add&userName="+inptUserName+"&password="+inptPassword+"&fullName="+inptFullname+"&emailId="+inptEmailId+"&roleName="+selRoleType;
if(inptUserName=="" || inptPassword==""||inptFullname==""||inptEmailId=="")
{
alert("Invalid inputs");
}
else
{
jQuery.get(
url,
"",
function(data) {
jQuery('#UserData').html(data);
//jQuery('#myclickdialog').empty();
},
"html"
);
myclose();
}
}
function myclose()
{
alert("hello");
document.getElementById('username').value="";
document.getElementById('password').value="";
document.getElementById('fullname').value="";
document.getElementById('emailId').value="";
jQuery('#myclickdialog').dialog('close');
//location.reload();
}
HTML:
<sj:dialog
id="myclickdialog"
autoOpen="false"
buttons="{
'Save':function() { submitDetails(); },
'Cancel':function() { myclose(); }
}"
modal="true"
title="Add User"
width="600"
cssStyle="display:none"
>
<table class='userTable'>
<tr><td colspan='2'><span class='usertableTitle'>User Details</span></td></tr>
<tr><td><span>User Name</span></td><td><input id='username' value='' type='text' maxlength='50'/></td></tr>
<tr><td><span>Password</span></td><td><input id='password' value='' type='password' maxlength='50'/></td></tr>
<tr><td><span>Full Name</span></td><td><input id='fullname' value='' type='text' maxlength='50'/></td></tr>
<tr><td><span>EMail-Id</span></td><td><input id='emailId' value='' type='text' maxlength='50'/></td></tr>
<tr><td><span>Role</span></td><td><select id='selOptions'><option value='Super User'>Super User</option><option value='Asset Manager'>Asset Manager</option><option value='Asset Viewer (Read only)'>Asset Viewer (Read only)</option></select></td></tr>
</table>
</sj:dialog>
---CODE ENDS---
Even I tried with 'destroy' and 'remove' . None of these helped me.
Thanks in advance.