transfer value from one page to another?

This is a discussion on "transfer value from one page to another?" within the JavaScript Forum section. This forum, and the thread "transfer value from one page to another? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 10th, 2008, 16:51
New Member
Join Date: Feb 2008
Location: Lithuania
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
transfer value from one page to another?

Hello all,
I have simple form, lets say one text input field, one 'extra' button, ant one submit button.
When i press 'extra' button i get popup window. In that window is another form:text input field,and submit button. I enter some value in that input field, press submit button, popup window closes and entered value appears in that 'parent' form's (or how should that be called?...). text input field.
Maybe anyone,who understood what i said, could give me any ideas how to solve this 'problem'?
Thank you in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 10th, 2008, 17:18
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

Okay, so essentially you want a popup window to write values to the window that called it?

Basically, from your popup window you can use the special keyword opener to reference the opening window. So from within the popup you can use

Code: Select all
opener.document.getElementById('thisInput').value = document.getElementById('thatInput').value;
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 10th, 2008, 18:37
New Member
Join Date: Feb 2008
Location: Lithuania
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

Oh, i should shoot myself... I was already thinking about using AJAX and so on, and you gave me so simple solution... thank you very much
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 10th, 2008, 18:40
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

LOL - don't shoot yourself. The simpler things are usually the hardest to see initially
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 10th, 2008, 19:00
New Member
Join Date: Feb 2008
Location: Lithuania
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

One more thing: could you tell me,why this doesn't work on opera?....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 10th, 2008, 19:57
Junior Member
Join Date: Jul 2007
Location: Los Angeles
Age: 31
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

Can you post the code?

Last edited by imagn; Feb 10th, 2008 at 20:21.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 11th, 2008, 14:39
New Member
Join Date: Feb 2008
Location: Lithuania
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

As you wish...
(shorter version of code )
the popup:
Code: Select all
...etc....
<input type="text" id="txt1" name='a' />
<script type="text/javascript">
opener.document.getElementById('tata').value = document.getElementById('txt1').value;
 </script>
...etc....
the "main" window:

Code: Select all
...etc...
 <input type='text' name='test' id='tata' size='12' />

<input type='button' value='parinkti' onclick="window.open('sendcard/pick_color.php', 'color', 'width=300px height=250px')" />
...etc...
didn't want to waste your time, so i displayed only "most important" part.... As I said, thats works on mozilla, but doesn't work on opera on konqueror (haven't tried on IE, cuz now i dont have chance). Also tried to write window.opener.getElementById, instrad of opener.GetElementById, but there was no difference.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 11th, 2008, 14:48
New Member
Join Date: Feb 2008
Location: Lithuania
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: transfer value from one page to another?

oh,few minutes later i solved my problem by myself,and again i should shoot my self
just wrote that line in function and assigned it to "submit" button...

Code: Select all
<script type="text/javascript">
function baba () {
opener.document.getElementById('tata').value = document.getElementById('txt1').value;
}
 </script>
<input type='submit' name='siusti' value='gerai' onclick='baba()' />
thank you...again
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
domain transfer? clippo Hosting & Domains 7 Aug 14th, 2007 19:24
Image transfer Urban Pigmy Flash & Multimedia Forum 3 Feb 28th, 2007 19:42
Keep Positioning after Transfer sawa Search Engine Optimization (SEO) 7 Feb 13th, 2007 14:37
Website Ftp Transfer Help russfall Starting Out 6 Feb 8th, 2007 04:57
£49 to transfer out!!! Do you agree?? christopher Hosting & Domains 7 May 20th, 2006 11:59


All times are GMT. The time now is 19:24.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42