ass values between two pages

J

Jason

hi all,

when a user click a button on 'parent' page, then 'child' page pop-up and get
focusd. When user select data from two dropdown box (or other controls), then
they click submit button at 'child' page, then the 'child' page closed itself
and return values to 'parent' page (two textbox).

How can I do this in JavaScript? The reason I am using JavaScript because other
programmers web apps will also call my 'child' page too.

Thanks in advance.
 
T

Terry Burns

Pass the selected values back to a function on the calling page

//Calling Page
function myChildHanlder( valueForAction )
{
//Take some action here with the value passed to me
//Usually pass this to a hidden field
__doPostback();

}

//On Child Form

window.opener.myChildHandler( theValueToPassBack );

//In Asp.net
On PreRender event, look at the hidden field and act upon it.


HTH
 
E

Eliyahu Goldin

The directions:

The parent calls window.showModalDialog("child.aspx",...)

If child.aspx doesn't take any server-side action on clicking "Submit", make
"Submit" a simple html button and handle onclick event in javascript. In
javascript event handler make an object encapsulating the selected values
you want to pass back to the parent form. Assign this object to
window.returnValue and call window.close();

The parent will get the object as the return value of the showModalDialog
call. It can take separate selected value contained in the object and assign
them to the textbox's value property.


Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top