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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit a form to multiple frames in a frameset

Status
Not open for further replies.

GraciePoo

Technical User
Mar 16, 2001
15
US
I have a frameset set up.

There is a top frame called "menu" across the top and three frames lined up next to each other below that frame. Respectively, their names are "left" (left.cfm), "middle" (middle.cfm), and "right" (right.cfm). The user submits a form in the top frame. I want to be able to submit the form so that the variables are passed to frames "left", "middle", and "right". I know this probably involves javascript but I have no idea how to use it. Any help would be appreciated.

Since I have no knowledge of javascript, I would need to be babied in this answer. Heh, sorry.
 
What you could try is to submit to multiple pages, but this is probably not allowed, so if that won't work you will have to just write a function which sets the source page of the other frames with the addition of the query string returned from the form -so:

1. submit to one of the frames.
2. grab the query string (form name=value pairs);
3. send off to other pages.

I am trying to think minimal JavaScript, but you may not be able to avoid it!
something like:

function dispatch(){
//grab the query String
var queryString = document.location.search;
//set the content of other frames
parent.middle.document.location = "middle.cfm" + queryString;
parent.right.document.location = "right.cfm" + queryString;
}

This will mean the URL of the middle page is now:

middle.cfm?formdata=value

And you can obtain the data from the location object as above - and/or manpulate it with ColdFusion before it loads.

So this code would be used in a function residing in the page specified in the action attribute of your form. If you need ever to submit somewhere else, like a servlet, just use a hidden form, and call it's submit method.

If this is unclear - give me a yell
You may have trouble setting the content of the frames that way too - it seems to change the whole frameset? One thin that would work is an invisible link - whos click() you call,but thats more j.... it late, must go ;-)
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top