New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Need Help for Pop Up windows


Post Reply New Thread Subscribe

 
Thread Tools
rkuwadia
Guest
 
Posts: n/a

Hello,

I have a script in which from parent browser, I open a pop up window.
Clicking submit on Pop up window, should close the pop up window and submit the
values to the parent window.


The code on parent window(say parent.php) is something like this:

<script language=javascript>
window.name="jobpost";
window.open('xyz.php', 'xxx');
</script>

The code on xyz.php is something like this:
<form name=form1 method=post target=jobpost>
<input type=button value="Apply" onclick="javascript:OnApply();">
</form>


<script language=javascript>
function onApply(){
document.form1.action="parent.php";
document.form1.submit();
self.close();
}
</script>


The above code works on windows IE as well as NN.
But it doesnot work on Mac. It gives lot of errors . When I do not submit to parent window, no error comes.


Can anyone help me on this issue?I have no button named Submit in pop up window as well as parent window.

Thanks
QUOTE Thanks
Murlyn

 
Murlyn's Avatar
 
Member Since: Jun 11, 2003
Location: Mount Vernon, WA
Posts: 4,909
Murlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to all
Mac Specs: MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2

Murlyn is offline
Ok here is my popup code...

Code:
function popup( page, title, w, h, scroll ) {
  if (!title) title = 'Popup';
  if (!scroll) scroll = 'no';
  if (!w) w = 500;
  if (!h) h = 350;
  var wintop = (screen.height - h) / 2;
  var winleft = (screen.width - w) / 2;
  var atts = 'width='+w+',height='+h+',scrollbars='+scroll+',resizable,screenX=150,screenY=150,top='+wintop+',left='+winleft+'';
  win = window.open( page, title, atts);
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
When submitting to the parent window use

Code:
top.opener.location.href
If you need more help please reply and we'll go through everything that you are doing.. it would help to see exactly what your code is.. maybe even a working example or at least the non working one

Cheers!
QUOTE Thanks
rkuwadia
Guest
 
Posts: n/a

Thanks for this much help.

The problem is I need values from pop up window into the parent window.

If I use, top.opener.location.href, then the page doesnot get submitted and I donot get values.

If I use javascript to assign values, like top.opener.form1.field1.value it gives problem with array elements.

I am using php to code.

I have a field called grades which is an array.
So to use something like following, doesnt work in Javascript.

document.popup.grades[].value = top.opener.posting.grades[].value;


Do you have any suggestion for the above problem?
QUOTE Thanks
Murlyn

 
Murlyn's Avatar
 
Member Since: Jun 11, 2003
Location: Mount Vernon, WA
Posts: 4,909
Murlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to allMurlyn is a name known to all
Mac Specs: MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2

Murlyn is offline
Hmm... I see what you are saying.. Ok what I would do is submit the form to <?=$_SERVER["PHP_SELF"]?> then parse your post variables

PHP Code:
// Get the number of values in $grades array
$numGrades count($_POST['grades']);

// Go through every grade value and assign a new variable name
for ($i=0$i<$numGrades$i++)
  
$gradeArr[] = "grades{$i}=".$_POST['grades'][$i];

// Transform the array into a URL string
$grades implode('&'$gradeArr);

// You might want to urlencode the string afterwards
$grades urlencode($grades); 
This will stick your array into this form:

grade1=value&grade2=value&grade3=value

so forth and so forth.. that should help you out a bit there..
QUOTE Thanks

Post Reply New Thread Subscribe


« html question | Dreamweaver »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Where Are The Windows Switchers? mimmyhonker Switcher Hangout 12 07-15-2008 04:19 PM
iPod for Windows and Mac? MacAddikt iPod Hardware and Accessories 12 03-31-2007 09:33 AM
Windows 2003 File Sharing darvay1 OS X - Operating System 0 09-08-2004 09:43 AM
Mac dial in to Windows RRAS tips kermit4karate OS X - Operating System 1 08-13-2004 01:56 PM
Windows XP on my mac natey Switcher Hangout 5 03-14-2004 01:00 AM

All times are GMT -4. The time now is 08:59 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?