Set field value to value of field in another frame

I have a frameset that contains two frames - frameLeft and frameMain.

frameLeft is used as a navigation bar, two of the options available are Add New Company and Add Key Contact. In addition, there is also a drop down list, which allows the user to select a company name.

When the user clicks the Add New Company option, they are required to enter company details (in frameMain) and are automatically taken to the Add Key Contact form. A hidden field on this form is set to pick up the company name from the Add New Company form (Default Value=CompanyName).

However, the user also has the option to add a new contact, without adding a new company. Therefore, I would like to pick up the company name for the hidden field from the drop down list in the frameLeft frame.

I tried to set up an @If to say if the CompanyName is empty then use then use the CName field, but I can’t get it to work. Is this possible using formula language?

Any ideas or suggestions would be greatly appreciated. Thanks in advance.

Subject: Set field value to value of field in another frame

by using something like:parent.frameA.document.title.value = document.detailForm.b.value

Subject: RE: Set field value to value of field in another frame

Thanks - is this formula language? I’m goning to give it a try, place it in the default value of a test field I have set up.

Subject: RE: Set field value to value of field in another frame

no this is java script

Subject: RE: Set field value to value of field in another frame

Thanks for your help, though I have been unable to get it to work so far.

Subject: RE: Set field value to value of field in another frame

are you getting errors?are the fields in question editable or computed?

Javascript can not update computed fields nor fields on documents that are not in edit mode

Subject: RE: Set field value to value of field in another frame

In the onLoad event of the form, I have the following javascript:

document.forms[0].Test.value = parent.document.forms[1].AName.value;

The Test field is in frameMain nad the AName field is in frameLeft. If I set the test field to “Test”, all is fine, but I cannot seem to get the syntax for grabbing the value of the field on the other form in the other frame.

I get the error “Menu” is undefined.

Any ideas as to what I may be doing wrong?

Once again, thanks in advance.

Subject: RE: Set field value to value of field in another frame

I do not think you can retrieve data like that.I think you can only send data.

frameLeft has to send data to frameMain

again not sure that frameMain can get data from frameLeft

that might be where you are breaking down

Subject: RE: Set field value to value of field in another frame

Of course you can retrieve data that way. The problem here is that “parent” is the frameset window, not the frame containing the document you want to look at. You’d need to look at parent.framename.document.forms[0].fieldname.value.

Subject: RE: Set field value to value of field in another frame

So…the following code should work:

document.forms[0].Test.value = parent.Menu.document.forms[0].CName.value;

Test being the field I want to set

Menu being the frame I am trying access

CName being the field on the frame that a I am trying to access.

I am not getting any errors, but my Test field is still empty. Do I need to do something special because AName is a dialog list?

Thanks for all of your help!!

Subject: RE: Set field value to value of field in another frame

Yes, a dialog list will change things, but I’m on my way into a meeting right now. If no-one else has answered in the next half-hour or so, I’ll be back…

Subject: RE: Set field value to value of field in another frame

Thanks Stan - I’ve figured it out!!

document.forms[0].Test.value = parent.Menu.document.forms[0].AName.options[parent.Menu.document.forms[0].AName.selectedIndex].text;

works like a charm.

Once again I am in debt to you…

Subject: RE: Set field value to value of field in another frame

This formula seemed to work set coded in onLoad and compossing new document. However I noticed that it does not work if I re-open an existing document. It looks like the parent.FrameName.document.forms[0] isn’t valid, called the second time. That’s can’t be logic…so here am i seeking someone to enlighten me. I must be missing something.

I tried to use window alert to check the value…but it looks as if there is something wrong with the method.