Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting content from a popup in original window

Status
Not open for further replies.
Jul 28, 2011
167
NG
Hi guys,
I have a little issue here.
I want to focus on a textbox. When I focus, it should launch a popup window that contains a list of predefined selectable items.Users can select an item; the popup window should close and the original textbox should be filled with the selected value (in the original window).
I've seen this implemented in a certain site before.I think I can try something with some server-side coding using session state. But I'm thinking this might be easier with some other methods.

Any ideas

____________________
Men put up a strong face just to cover their weaknesses...good!
But a smile makes them live longer....
Which would you choose?

Think about it.
 
I suggest:

Set the onfocus event of your text box to a function that draws your popup window and populate it with the selectable data items. Set the onclick event of your data items to populate the text box and close the window.

Start coding and ask for help when/if you have some code written that you need help with...

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
I just noticed this issue was not resolved since Sept and tought I should post the solution I adopted

in the main window, I have:
<input type="input" onclick="javascript:getValues window.toGet=$(this).attr('id'));" id="thePop">

Add small script
function popwindow(url, what) {
var toGet = what;
//alert(toGet)
newwindow = window.open(url, 'popTest', 'height=500,width=400, scrollbars=1, status=1, resizeable=1');
newwindow.moveTo(20, 30);
if (window.focus) { newwindow.focus(); }
}
function getValues(url, id) {
popwindow(url, id);
}

In the popup, I have

<input type="radio" value="something" onclick="doJavascript()" />
<script>
function doJavascript() {
opener.document.getElementById(window.opener.toGet).value=document.form1.codeTitleName.value
self.close();
}

SImply sImPlE
</script>

____________________
Men put up a strong face just to cover their weaknesses...good!
But a smile makes them live longer....
Which would you choose?

Think about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top