I need alternate solution for window.showmodaldialog() function.

1,472 views
Skip to first unread message

what ubecomes

unread,
Apr 25, 2016, 6:34:01 AM4/25/16
to Chromium-discuss
Hi

I need alternate solution for window.showmodaldialog() function, which is not working in chrome. my Chrome Version  is 49.0.2623.112 m.

My actual code is

in parent window:
----------------------------
<td align="center" class="mailtd">
<a href="javascript: deleteUserAlert('<bean:write name="usr" property="roleName" />','<bean:write name="usr" property="userRoleId" />','<bean:write name="usr" property="userId" /> ');">Delete</a>
|<a href="javascript:editC('<bean:write name="usr" property="userId" />','<bean:write name="usr" property="roleId" />');">Select</a>
</td>

function deleteUserAlert(roleName, userRoleId,userId) {
var url='<%=request.getContextPath()%>/PSETUP/abc.jsp?userRoleId='+userRoleId+'&screenId=<%=screenId%> &userId='+userId;
var retObj=window.showModalDialog(url, '_self', 'status:1; resizable:1; dialogWidth:800px; dialogHeight:350px; dialogTop=300px; dialogLeft:400x');

if(retObj.value == "delete") {
window.location.href='mpusers.do?action=Delete&userRoleId='+userRoleId+'&screenId=<%=screenId%>';
} else if(retObj.value == "cancel") {
//alert("cancel");
}

abc.jsp
----------------
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr><td align="center">Are you sure you want to delete <%=userId%>?<br></td></tr>
 <tr><td align="center"><input type="button" value="Delete" onclick="javascript:return deleteThis();"><input type="button" value="Cancel" onclick="javascript:return cancelThis();"></td></tr>
  </table>

function deleteThis(){
   var obj = new Object ;
   obj.value="delete"
  window.returnValue=obj;
  window.close();
}

function cancelThis(){
 var obj = new Object ;
 obj.value="cancel"
window.returnValue=obj;
window.close();
}

so I am trying to replace this code using window.open() method. could any one please help me, how i can proceed next? Using below code i am able to open a popup window and i am able to call setValue() method which exist in parent jsp. when i click on delete button in the popup, i am getting alert but next code(window.location.href="....") is not working. Could any one tell me where i did a mistake. what is the code i can place it instead of "window.location.href='mpusers.do?action=Delete&userRoleId='+userRoleId+'&screenId=<%=screenId%>';"

in parent jsp:
----------------------------
<td align="center" class="mailtd">
<a href="javascript: deleteUserAlert('<bean:write name="usr" property="roleName" />','<bean:write name="usr" property="userRoleId" />','<bean:write name="usr" property="userId" /> ');">Delete</a>
|<a href="javascript:editC('<bean:write name="usr" property="userId" />','<bean:write name="usr" property="roleId" />');">Select</a>
</td>

function deleteUserAlert(roleName, userRoleId,userId) {
var url='<%=request.getContextPath()%>/PSETUP/abc.jsp?userRoleId='+userRoleId+'&screenId=<%=screenId%> &userId='+userId;
window.open(url, '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1, width=800, height=350, left=400, top=300', '');
}

function setValue(str){
         if(str == "delete") {
                alert(1);
window.location.href='mpusers.do?action=Delete&userRoleId='+userRoleId+'&screenId=<%=screenId%>';
} else if(str == "cancel") {
//alert("cancel");
}
abc.jsp
----------------
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr><td align="center">Are you sure you want to delete <%=userId%>?<br></td></tr>
 <tr><td align="center"><input type="button" value="Delete" onclick="javascript:return deleteThis();"><input type="button" value="Cancel" onclick="javascript:return cancelThis();"></td></tr>
  </table>

function deleteThis(){
   window.opner.setValue("delete");
  window.close();
}

function cancelThis(){
 window.opner.setValue("cancel");
  window.close();
}

Thanks

Primiano Tucci

unread,
Apr 25, 2016, 8:15:28 AM4/25/16
to whatub...@gmail.com, Chromium-discuss
Dialogs is one of those things covered by any single JS framework this world has ever seen. Why are you trying to implement your own and not reusing one of the many, such as:



--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

Reply all
Reply to author
Forward
0 new messages