Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submitting forms from a different frame! 1

Status
Not open for further replies.

cturland

Programmer
Sep 25, 2000
66
GB
Hi all,

Ok let me try and explain my problem!! ...... I have a top menu bar in its own frame that has a save button on it. When this save button is clicked on I need it to save the data that is currently present in the main frame window. The main frame window has many different pages though.

Is it possible to envoke the submit button on another page through a javascript: onclick? And what would be the best way of recognising what page is currently being displayed in my main frame?!

Thanks,
Carl
 
let's say the upper frame is named "banner" and the main one is named "main"

> Is it possible to envoke the submit button on another page through a javascript: onclick?
yes, just use :
top.main.the_name_of_the_form.submit()

> And what would be the best way of recognising what page is currently being displayed in my main frame?!
can you use some sort of cgi script ? if not, i don't see any obvious solution ... i've done this but in a weird way : every time i load a page in "main" i add an url parameter, this way i always know where i am but it's really inelegant, heavy, expensive ...
i hope someone else can help for this, if not let me know i'll try to help more



 
As far as the first part of your statement, to access a form in another frame and submit it you can say:

parent.framename.formname.submit()

the second part of your question, I don't quite understand jared@aauser.com
 
parent.framename.document.location will give you the url of the frame. And I think you can use parent.framename.forms[0].submit() to submit the first form on your page, no matter what page it is.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top