Shaji
asked on
How to get the value from child window to parent across all major browsers?
I am trying to get the selected value from a child window to parent and it works in Firefox but not in Chrome. I need to test this feature across all major browsers viz. Firefox, Chrome, Safari, Opera and IE. Please help
Is there any jQuery equivalent for this feature which will work across all major browsers?
Code for parent window
====================
<html>
<head><title>User Provisioning</title></head >
<body>
<form name="mgr">
<label>Reporting Manager</label>
<input type="text" name="manager" id="manager"></input>
<button name="getManager" onclick="window.open('mana gerDetails .html', 'managerConsole', 'width=300,height=300')">g etManager< /button>
</form>
</body>
</html>
Code for child window
==================
<html>
<body>
<h1>People Manager</h1>
<form name="peoplemanager">
<input type="radio" name="manager" value="Thomas (100001)" />Thomas<br>
<input type="radio" name="manager" value="Ambrose (100002)" />Ambrose<br>
<input type="radio" name="manager" value="Richards (100003)" />Richards<br>
<input type="radio" name="manager" value="Helen (100004)" />Helen<br>
<input type="radio" name="manager" value="Robert (100005)" />Robert<br>
<input type="button" id="getManager" value="getManager"></butto n>
</form>
<script>
var mgr = document.getElementById("g etManager" );
mgr.onclick = function() {
var val = window.peoplemanager.manag er.value;
var txt = window.opener.document.get ElementByI d("manager ");
txt.value = val;
window.close();
}
</script>
</body>
</html>
Is there any jQuery equivalent for this feature which will work across all major browsers?
Code for parent window
====================
<html>
<head><title>User Provisioning</title></head
<body>
<form name="mgr">
<label>Reporting Manager</label>
<input type="text" name="manager" id="manager"></input>
<button name="getManager" onclick="window.open('mana
</form>
</body>
</html>
Code for child window
==================
<html>
<body>
<h1>People Manager</h1>
<form name="peoplemanager">
<input type="radio" name="manager" value="Thomas (100001)" />Thomas<br>
<input type="radio" name="manager" value="Ambrose (100002)" />Ambrose<br>
<input type="radio" name="manager" value="Richards (100003)" />Richards<br>
<input type="radio" name="manager" value="Helen (100004)" />Helen<br>
<input type="radio" name="manager" value="Robert (100005)" />Robert<br>
<input type="button" id="getManager" value="getManager"></butto
</form>
<script>
var mgr = document.getElementById("g
mgr.onclick = function() {
var val = window.peoplemanager.manag
var txt = window.opener.document.get
txt.value = val;
window.close();
}
</script>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi fraigor,
This script still does not work in the latest version of Chrome, Safari, Opera and IE in Windows 8.1, but it works in Firefox.
Is there any alternate way (for example, using jQuery) of achieving the same?
Please help.
Thanks in advance.
This script still does not work in the latest version of Chrome, Safari, Opera and IE in Windows 8.1, but it works in Firefox.
Is there any alternate way (for example, using jQuery) of achieving the same?
Please help.
Thanks in advance.
ASKER
Greetings,
I used the dialog from JQuery UI and it seems to do the trick.
https://api.jqueryui.com/dialog/
Thanks hielo and fraigor, for your valuable inputs.
I used the dialog from JQuery UI and it seems to do the trick.
https://api.jqueryui.com/dialog/
Thanks hielo and fraigor, for your valuable inputs.
ASKER
In Safari and IE, it is giving 'undefined' value as soon as the window closes
In Opera and Chrome, it is not even closing the window and nothing shows up in the text field (in the parent window)
I am using the following browser versions on Windows 8.1, 64 bit machine
Chrome - Version 45.0.2454.37 beta-m (64-bit)
Firefox - 410b2
IE - 11
Safari - 5.1.7
Opera - 23.0.1522.75
Please help