need to copy a value from 1 field to another in a frameset (web)


i have a web application with 2 frames.
both frames contains a form with one filed where you can eneter a number.

in frame 1 the number is entered and the user presses a button.
then a text is displayed.
if the text is ok the user enters the same number in the form of frame 2.

how can i make it that when the number is enteed in frame 1 and the button is pressed that this number is displayed as "default" in frame 2.

the user would not need to enter it again.

the button in frame 1 does just submit the form via java-script:  document.forms[0].submit()

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

When the user presses the button in frame 1, there is already a form open in frame 2?

If so, then if your submit button is written in JavaScript, then you can overwrite the field in the form in frame 2, something like the following:

var srcVal = document.forms[0].fieldname.value;
parent.frame2.document.forms[0].otherfieldname.value = srcVal;

I'm assuming some things here about the names of your fields, frames, and how many forms you have on your pages, but this syntax should to the trick.
hreinartAuthor Commented:

it doesn't work and i get no error message.

this code is in the button of frame1 to submit it:

var srcVal = document.forms[0].searchstring.value;
parent.frame3.document.forms[0].buchnummer.value = srcVal;

regarding the amount of frames i was wrong; there are 3 frames.

any idea?

Replace the fieldname with your orginial field name


CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

hreinartAuthor Commented:

looks interesting....

this code should
be copied in the button of the 1st frame?
..or is this the value of the field in frame2 ?

the word frame2 and frame1  need to be exchanged with the real frame names?

hreinartAuthor Commented:

it look now like this and doesn't work:


rueckgabe-unten = frame2 with filed buchsuche
suche-oben = frame1 with field searchstring
hreinartAuthor Commented:

i found someone who told me how to do it.
this version works now.

it's similar to the suggested versions, but they all didn't work.
i don't understand why, but i'm also happy to have a code that works like needed.

parent.frames["ruekgabe-unten"].document.forms[0].buchnummer.value = srcVal;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hreinartAuthor Commented:
answered it myself, please delete and refund points
hreinartAuthor Commented:

what do you mean by other obligations here?

i answered the question myself.

isn't ok to delete and refund?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.