Link to home
Start Free TrialLog in
Avatar of hreinart
hreinart

asked on

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

hi,

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.


question:
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.

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


Avatar of tiler
tiler

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.
Avatar of hreinart

ASKER

hi,

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;
document.forms[0].submit()

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



any idea?

Replace the fieldname with your orginial field name

parent.frames["frame2"].document.all.<yourfieldname>.value=parent.frames["frame1"].document.all.<yourfieldname>.value

Partha
hi,

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?



thanks
hreinart
hi,

it look now like this and doesn't work:

parent.frames["rueckgabe-unten"].document.all.buchnummer.value=parent.frames["suche-oben"].document.all.SearchString.value;
document.forms[0].submit()

rueckgabe-unten = frame2 with filed buchsuche
suche-oben = frame1 with field searchstring
ASKER CERTIFIED SOLUTION
Avatar of hreinart
hreinart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
answered it myself, please delete and refund points
hi,

what do you mean by other obligations here?

i answered the question myself.

isn't ok to delete and refund?

hreinart