Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 21st, 2004, 12:05 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing form values from 1 frame to another.

I have found out a way to pass forms from one frame to another but with the script I found, I can only pass one form field. I would like to pass 3 or more.

Here is a demo of what I mean:

http://www.planet-cyber.org/frame_pass_set/

As you can see by the demo, Only the email gets added to all field but I would like to add Email in the email field, Name in the name filed, and user name in the user name field of the form on the left, from the right.
Reply With Quote
  #2 (permalink)  
Old January 21st, 2004, 12:41 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I would change the passText function to:
Code:
function passText(Name, Value)
{
  top.frames['right'].document.yourform[Name].value = Value;
}
then change your button to:
Code:
<INPUT onclick="parent.passAll(this.form);" type=button value=Add!>
and finally add the passAll function to the page with passText function:
Code:
function passAll(Form)
{
  passText("email", Form.user.value);
  passText("teacher", Form.user1.value);
  passText("user", Form.user2.value);
}
Note I renamed the textbox called 'name' to 'teacher'. This is because the expression 'yourform.name' is ambiguous, does it mean the name of the form or the element called 'name'? This can cause problems.

--

Joe
Reply With Quote
  #3 (permalink)  
Old January 21st, 2004, 01:02 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you so much for that very fast reply Joe.

Best regards Edward.

Reply With Quote
  #4 (permalink)  
Old February 2nd, 2004, 11:53 AM
al al is offline
Registered User
 
Join Date: Feb 2004
Location: portsmouth, , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is "top.frames['right'].document" be browser specific ?

Reply With Quote
  #5 (permalink)  
Old February 2nd, 2004, 12:33 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

i believe it's standard, isn't it working on your browser?
If not it could be because the document in quetion is not in the same domain, i.e. from the same server and usaing same protocol (both HTTP rather than one HTTP and the other HTTPS for example) as the frame where the code is. This would be a security violation so is not allowed.

Joe

--

Joe
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing Multidimensional Array Values back to form stitch Classic ASP Databases 2 June 21st, 2013 02:59 PM
Passing Form Values in ASP.Net sankar General .NET 10 September 21st, 2006 12:13 PM
Passing values to a form mschenk Access VBA 4 November 30th, 2003 11:39 PM
Passing Values from a Form to another Louisa Beginning VB 6 1 September 2nd, 2003 08:56 AM



All times are GMT -4. The time now is 01:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.