...

View Full Version : Popup Window from parent window



shanthivarshu
03-19-2009, 06:07 AM
Hai, In parent window, while submitting form, popup window is called. In child popup window, parent window is forced to go invisible through code. But sometimes it is not working.
Aim is to inactive all elements in parent form or invisible parent form while child window (popup) is opened. After closing popup, parent form should be in visible state.

Any help is appreciated.




In parent Window: (userinfo.php)

<script type="text/javascript">
<!--

var popUpWin = null;
function popUpWindow(URLStr, ChildwinnameStr)
{
if(popUpWin)
{
if(!popUpWin.closed) {popUpWin.close();}
}


popUpWin = window.open(URLStr,ChildwinnameStr, "status=1,width=400,height=200,left=350,top=200,titEvent_Idlebar=no,scrollbars=no,minimize=no,resizab le=no,modal");

if(window.Focus && !popUpWin.closed)
{
popUpWin.focus();
}

}

function validate_parent(form)
{

if (Modtag==0)
{
popUpWindow('Adduserform.php', 'AdduserWin');
return false;
}
if (Modtag==1)
{
popUpWindow('Modifyuserform.php', 'ModuserWin');
return false;
}


}
</script>

<form name=”frmparent” onSubmit=" validate_parent (this);" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

Pop up Window or child window (Adduserform.php) :

<html>
<head>
<script type=”text/javascript”>

function post_value()
{
self.close();
window.opener.location.href=" userinfo.php ";
}


function setFocusTextbox()
{
document.frmAdduser.UserName.focus();
window.opener.document.forms[' frmparent '].disabled=true; //To inactivate Parent window
}
</script>
</head>
<body onload="setFocusTextbox()">
<form name="frmAdduser" onload="setFocusTextbox()" onSubmit="Validate_userdetails()" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">

<tr><td align="center" class="textstyle" nowrap="nowrap"> Enter User Name</td>
<td class="textstyle">
<input type="text" name="UserName" maxlength=5 size=12 onKeyPress="return NumbersOnly(this,event)" >
</td>
</tr>
</table>

<br><div align="center"><input type="submit" name="AddBttn" value="Add">
<input type="button" name="CancelBttn" value="Cancel" onclick="post_value();"></div>
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum