HighDots Forums  

forms and frames

Javascript JavaScript language (comp.lang.javascript)


Discuss forms and frames in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew Clark
 
Posts: n/a

Default forms and frames - 09-21-2003 , 11:11 PM








hello,

i have a pages that loads 2 frames, the top is a "does this look all
right?" frame with 2 links, yes and no. the bottom is the page the user
is looking at. the top also contains a form with information to be passed
to the next page. i can't figure out how to break out of the frame on a
submit. if that is unclear, here is a bit of code:

frame.html:

....
<FRAMESET ROWS="80,*" FRAMEBORDER="no" BORDER="0" FRAMESPACING="0">
<FRAME NAME="top" SCROLLING="no" NORESIZE SRC="join_2_1.php?<?php
echo $src; ?>" />
<FRAME NAME="main" SCROLLING="auto" SRC="<?php echo $SiteUrl; ?>" />
</FRAMESET>
....

join_2_1.php:

....
<SCRIPT>
function submitForm(formIndex) {
var form = document.forms[0];

if (formIndex == 0) {
form.action = "join3.php";
} else if (formIndex == 1) {
form.action = "join.php";
}
form.submit();
}
</SCRIPT>
....
<TABLE BORDER="0">
<TR>
<TD COLSPAN="2">Does your site look OK without violating our rules?
</TD>
</TR>
<TR>
<TD ALIGN="center">
<A TARGET="_top" HREF="javascript:submitForm(0);">YES</A>
</TD>
<TD ALIGN="center">
<A TARGET="_top" HREF="javascript:submitForm(1);">NO</A>
</TD>
</TR>
</TABLE>
<FORM METHOD="post" ACTION="join3.php">
<INPUT TYPE="hidden" NAME="ref" VALUE="<?php echo $ref; ?>" />
<INPUT TYPE="hidden" NAME="Name" VALUE="<?php echo $Name; ?>" />
<INPUT TYPE="hidden" NAME="Email" VALUE="<?php echo $Email; ?>" />
<INPUT TYPE="hidden" NAME="pass1" VALUE="<?php echo $pass1; ?>" />
<INPUT TYPE="hidden" NAME="pass2" VALUE="<?php echo $pass2; ?>" />
<INPUT TYPE="hidden" NAME="ViewEmail" VALUE="<?php echo $ViewEmail;
?>" />
<INPUT TYPE="hidden" NAME="SiteName" VALUE="<?php echo $SiteName;
?>" />
<INPUT TYPE="hidden" NAME="SiteUrl" VALUE="<?php echo $SiteUrl; ?>" />
<INPUT TYPE="hidden" NAME="SiteLanguage" VALUE="<?php echo
$SiteLanguage; ?>" />
</FORM>
....

when i click a link in the top frame, the next document that loads does
not break out of the frame. any ideas?

andrew


-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----


Reply With Quote
  #2  
Old   
Greg Griffiths
 
Posts: n/a

Default Re: forms and frames - 09-26-2003 , 06:48 PM






You can use the TARGET attibute with a FORM to target the top frame.

Andrew Clark wrote:

Quote:

hello,

i have a pages that loads 2 frames, the top is a "does this look all
right?" frame with 2 links, yes and no. the bottom is the page the user
is looking at. the top also contains a form with information to be passed
to the next page. i can't figure out how to break out of the frame on a
submit. if that is unclear, here is a bit of code:

frame.html:

...
FRAMESET ROWS="80,*" FRAMEBORDER="no" BORDER="0" FRAMESPACING="0"
FRAME NAME="top" SCROLLING="no" NORESIZE SRC="join_2_1.php?<?php
echo $src; ?>" /
FRAME NAME="main" SCROLLING="auto" SRC="<?php echo $SiteUrl; ?>" /
/FRAMESET
...

join_2_1.php:

...
SCRIPT
function submitForm(formIndex) {
var form = document.forms[0];

if (formIndex == 0) {
form.action = "join3.php";
} else if (formIndex == 1) {
form.action = "join.php";
}
form.submit();
}
/SCRIPT
...
TABLE BORDER="0"
TR
TD COLSPAN="2">Does your site look OK without violating our rules?
/TD
/TR
TR
TD ALIGN="center"
A TARGET="_top" HREF="javascript:submitForm(0);">YES</A
/TD
TD ALIGN="center"
A TARGET="_top" HREF="javascript:submitForm(1);">NO</A
/TD
/TR
/TABLE
FORM METHOD="post" ACTION="join3.php"
INPUT TYPE="hidden" NAME="ref" VALUE="<?php echo $ref; ?>" /
INPUT TYPE="hidden" NAME="Name" VALUE="<?php echo $Name; ?>" /
INPUT TYPE="hidden" NAME="Email" VALUE="<?php echo $Email; ?>" /
INPUT TYPE="hidden" NAME="pass1" VALUE="<?php echo $pass1; ?>" /
INPUT TYPE="hidden" NAME="pass2" VALUE="<?php echo $pass2; ?>" /
INPUT TYPE="hidden" NAME="ViewEmail" VALUE="<?php echo $ViewEmail;
?>" /
INPUT TYPE="hidden" NAME="SiteName" VALUE="<?php echo $SiteName;
?>" /
INPUT TYPE="hidden" NAME="SiteUrl" VALUE="<?php echo $SiteUrl; ?>" /
INPUT TYPE="hidden" NAME="SiteLanguage" VALUE="<?php echo
$SiteLanguage; ?>" /
/FORM
...

when i click a link in the top frame, the next document that loads does
not break out of the frame. any ideas?

andrew

-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.