Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 26, 2007 11:17 AM by NC01
Member
10 Points
33 Posts
Dec 24, 2007 12:35 PM|LINK
Hi,
I am doing the following. I am calling popup.aspx having a textbox to populate my textbox kept in default.aspx
All works well, however the value is not returned when using firefox. Can you please tell me where I am wrong and what to change.
thanks
Contributor
2580 Points
480 Posts
Dec 24, 2007 01:02 PM|LINK
you can find your answer here. window.ReturnValue is not supported by FF.
All-Star
29935 Points
5821 Posts
Dec 24, 2007 01:14 PM|LINK
innerText is IE only. You need to use innerHTML.
Eric
Dec 24, 2007 01:47 PM|LINK
I used innerHTML earlier but did not get any value in the textbox. Then i changed it to innerText
Anyways can any of you help me out with the code. What do I change in my code? I saw the link but could not understnad what to change in my code.
Plz..i need this solution soon..build team is on my head
thanks.
82577 Points
15430 Posts
MVP
Dec 24, 2007 04:02 PM|LINK
Looks like the variable src is a reference to a TextBox, so instead of src.innerText = res; use src.value = res;
NC...
Dec 24, 2007 04:06 PM|LINK
Please help me..i tried that tooo.
Dec 24, 2007 04:22 PM|LINK
Well, if you're using FireFox, it will NEVER work, since the return from window.open is a reference to the window and not anything returned from the window. Other than that, using IE ONLY, I tested your code with no problems.
Dec 24, 2007 04:29 PM|LINK
Hello NC,
thanks for trying my code..but if you look at my first post, the code was 'always' working with IE. I had problems only while running it on firefox.
If the code given by me doesnt work, can u suggest me some code that will work for both IE and mozilla.
Kindly give it a try using my code. Thanks.
Dec 24, 2007 04:48 PM|LINK
Try this:
Default.aspx
<script type="text/javascript"> function OpenPop(txt) { if ( window.showModalDialog ) { res = window.showModalDialog('Popup.aspx','yes',"dialogHeight:100px"); document.getElementById(txt).value = res; } }
Popup.aspx
<script type="text/javascript"> function yes() { var textBoxRef = document.getElementById('TextBox1');
if ( window.showModalDialog ) { window.returnValue = textBoxRef.value; window.close(); } else { if ( (window.opener != null) && (!window.opener.closed) ) { window.opener.document.getElementById('TextBox1').value = textBoxRef.value; }
window.close(); } } </script>
You will have to make sure that TextBox1 is the correct ID in Default.aspx
Dec 25, 2007 03:51 AM|LINK
Thanks.
Is there any way i can avoid hardcoding 'TextBox1'. I mean i pass a controlid from Default.aspx using your code and access it on popup page
Something like this :
if ( window.showModalDialog ) { window.returnValue = textBoxRef.value; window.close(); } else { if ( (window.opener != null) && (!window.opener.closed) ) { window.opener.document.getElementById(controlid).value = textBoxRef.value; }
There may be a way using querystring but I wanted to avoid that. Any other way possible. thanks
kalpanachawl...
Member
10 Points
33 Posts
popup not returning value
Dec 24, 2007 12:35 PM|LINK
Hi,
I am doing the following. I am calling popup.aspx having a textbox to populate my textbox kept in default.aspx
All works well, however the value is not returned when using firefox. Can you please tell me where I am wrong and what to change.
thanks
Rinze
Contributor
2580 Points
480 Posts
Re: popup not returning value
Dec 24, 2007 01:02 PM|LINK
you can find your answer here. window.ReturnValue is not supported by FF.
Rinze Cats
---------
please select 'mark as answer' if this post helped you!
A1ien51
All-Star
29935 Points
5821 Posts
Re: popup not returning value
Dec 24, 2007 01:14 PM|LINK
innerText is IE only. You need to use innerHTML.
Eric
kalpanachawl...
Member
10 Points
33 Posts
Re: popup not returning value
Dec 24, 2007 01:47 PM|LINK
Hi,
I used innerHTML earlier but did not get any value in the textbox. Then i changed it to innerText
Anyways can any of you help me out with the code. What do I change in my code? I saw the link but could not understnad what to change in my code.
Plz..i need this solution soon..build team is on my head
thanks.
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: popup not returning value
Dec 24, 2007 04:02 PM|LINK
Looks like the variable src is a reference to a TextBox, so instead of src.innerText = res; use src.value = res;
NC...
kalpanachawl...
Member
10 Points
33 Posts
Re: popup not returning value
Dec 24, 2007 04:06 PM|LINK
Please help me..i tried that tooo.
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: popup not returning value
Dec 24, 2007 04:22 PM|LINK
Well, if you're using FireFox, it will NEVER work, since the return from window.open is a reference to the window and not anything returned from the window. Other than that, using IE ONLY, I tested your code with no problems.
NC...
kalpanachawl...
Member
10 Points
33 Posts
Re: popup not returning value
Dec 24, 2007 04:29 PM|LINK
Hello NC,
thanks for trying my code..but if you look at my first post, the code was 'always' working with IE. I had problems only while running it on firefox.
If the code given by me doesnt work, can u suggest me some code that will work for both IE and mozilla.
Kindly give it a try using my code. Thanks.
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: popup not returning value
Dec 24, 2007 04:48 PM|LINK
Try this:
Default.aspx
<script type="text/javascript">
function OpenPop(txt)
{
if ( window.showModalDialog )
{
res = window.showModalDialog('Popup.aspx','yes',"dialogHeight:100px");
document.getElementById(txt).value = res;
}
}
Popup.aspx
<script type="text/javascript">
function yes()
{
var textBoxRef = document.getElementById('TextBox1');
if ( window.showModalDialog )
{
window.returnValue = textBoxRef.value;
window.close();
}
else
{
if ( (window.opener != null) && (!window.opener.closed) )
{
window.opener.document.getElementById('TextBox1').value = textBoxRef.value;
}
window.close();
}
}
</script>
You will have to make sure that TextBox1 is the correct ID in Default.aspx
NC...
kalpanachawl...
Member
10 Points
33 Posts
Re: popup not returning value
Dec 25, 2007 03:51 AM|LINK
Hi,
Thanks.
Is there any way i can avoid hardcoding 'TextBox1'. I mean i pass a controlid from Default.aspx using your code and access it on popup page
Something like this :
Popup.aspx
<script type="text/javascript">
function yes()
{
var textBoxRef = document.getElementById('TextBox1');
if ( window.showModalDialog )
{
window.returnValue = textBoxRef.value;
window.close();
}
else
{
if ( (window.opener != null) && (!window.opener.closed) )
{
window.opener.document.getElementById(controlid).value = textBoxRef.value;
}
window.close();
}
}
</script>
There may be a way using querystring but I wanted to avoid that. Any other way possible. thanks