homepage Welcome to WebmasterWorld Guest from 54.198.42.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Populating a form in a popup from the parent webpage
scorpio




msg:1476051
 3:53 pm on May 14, 2003 (gmt 0)

Hi,

I am developing in PHP,JS,HTML,MySQL.

I have a list of links on a page. Each link should call a JS function to 'pop' another window up to display more detail.

The JS code:
vWindow = window.open('detail.php','Detail',style);

The deatil depends on which link was clicked.
Is there any way of populating fields in the popup window (depending on the link clicked)from the parent . I've tried things like...

vWindow.document.field1.innerHTML = "The detail text";
vWindow.field1.innerHTML = "The detail text";

Does that make sense?

Could I do it by POSTing variables to the detail.php script and then the detail can be read from the database depending on the variable that was POSTed?

Thanks in Advance

Raz

 

senior mcinvale




msg:1476052
 4:02 pm on May 14, 2003 (gmt 0)

yeah, do something like this:

vWindow = window.open('detail.php?field1=value1&field2=value2','Detail',style);

then in detail.php do this:

<?
echo "
<input type='text' name='field1' value='$_POST['field1']'>
<input type='text' name='field2' value='$_POST['field2']'>
";
?>

scorpio




msg:1476053
 12:13 pm on May 15, 2003 (gmt 0)

Thanks for the reply.

my code is:
vWindow = window.open('detail.php?x=00002','Detail',style);

I've called the php page as suggested, but when I reference the posted variable ($_POST['x']), it's empty.

Any ideas?

Cheers

senior mcinvale




msg:1476054
 2:44 pm on May 15, 2003 (gmt 0)

hmmm, that is rather odd... pull up the properties on the pop-up and make sure that the 'x=00001' part is getting passed in the javascipt to the page...

other than that i dont have any good ideas, you can mail me with URLs and ill check it out if you like. i will need sample code as well....

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved