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

How totarget 2 frames in a form instead of oneframe?

Status
Not open for further replies.

ale77

Programmer
Jul 18, 2003
38
US
Hi, I have 2 questions!
I have a page with 3 frames, one of the frames has a form and I want that when I submit the form it loads another page in the current frame (which I did with TARGET from the form) , and another page in the other frame. I have no idea how to change the second frame with the other page.

The second question is how can I pass the info of one form (I have a form with hidden values) to another different page that will have another form.

Is this too complicated????? help :(
 
so you want to submit the data to two frames? both frames will be using the form data?



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
:), nop, just one frame will use the form data!
 
<input type=submit onClick=&quot;parent.leftFrame.document.location.href='somePage.htm'&quot;>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Thanks mwolf00! That worked fine.
About the question from jemminger, I think I will need it for both frames.
 
if you need the data in both frames, you need to submit to both:

function doSubmit(form) {
form.action = &quot;firstForm.asp&quot;;
form.target = &quot;firstFrameName&quot;;
form.submit();

form.action = &quot;secondForm.asp&quot;;
form.target = &quot;secondFrameName&quot;;
form.submit();
}

<form>
...fields etc...
<input type=&quot;button&quot; onclick=&quot;doSubmit();&quot; value=&quot;submit&quot;/>
</form>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Jeff -

I've never submitted to two places (I've always handled that situation server-side). Have you actually done this with the same form going to two places?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
I have no clue how to use asp. Is there any other way to send the data of one page to another? Don't worry about frames.
 
If you use the method &quot;get&quot; for your form, you will send all of the form fields in the URL. You can retrieve them on the new page using the location.search value....

if the form has two fields (fName and lName) then URL would look something like this...

Code:
[URL unfurl="true"]http://www.mySite.com/readForm.htm?fName=John&lName=Doe[/URL]


to get the values you'd do this...

qStr = location.search
//qStr = &quot;?fName=John&lName=Doe&quot;

qStr = qStr.substr(1)
//removed the &quot;?&quot;
//could combine two steps like this...
//qStr = location.search.substr(1)
//qStr = &quot;fName=John&lName=Doe&quot;


qArr = qStr.split(&quot;&&quot;)
//qArr[0]=&quot;fName=John&quot;
//qArr[1]=&quot;lName=Doe&quot;


fNameField = qArr[0].split(&quot;=&quot;)[1]
//fnameField = &quot;John&quot;

lNameField = qArr[1].split(&quot;=&quot;)[1]
//lNameField = &quot;Doe&quot;

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Thanks mwolf00!
Your tips were very helpful for me. I'm still working on the hole thing but at least now I solved that little problem. Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top