|
-
Mar 13th, 2003, 05:03 AM
#1
Thread Starter
Fanatic Member
Javascript problem
I am submitting a form from one frame to another,
<form method="post" action="request.asp" target="main" name="form1">
<td width="80%" height="40" valign="middle" bgcolor="#CCCCCC" class="tdbutton">
<div align="center">
<input type="hidden" name="F_NAME" value="<%response.write V_NAME %>">
<input type="hidden" name="F_ACCESS" value="<%response.write V_ACCESS %>">
<input type="hidden" name="F_PROFILE" value="<%response.write V_PROFILE %>">
<a href="javascript:frames[0].document.form1.submit();">Request report</a> </div></td>
</form>
but get message form 1 is nul or not an object. does anyonme knwo why it cant fnd the form, i think it is looking for the form in my other frame as if i change te form name in the url to a form one my main frame it will submit ok.
please help
-
Mar 13th, 2003, 06:04 AM
#2
Frenzied Member
Well you don't really need the frames[] stuff in there, just use document.form1.submit() But also you aren't catering for people without JavaScript, so what you should do is this:
Code:
<script type="text/javascript"><!--
document.write('<a href="#" onclick="document.form1.submit();">Request report<\/a>');
//--></script>
<noscript><div><input type="submit"></div></noscript>
That way people with JS will see the link, and people without will just get a standard submit button, keeping everyone happy
-
Mar 13th, 2003, 10:15 AM
#3
Addicted Member
Also be aware that after IE4, microsoft (and netscape) changed the frames permission model, so often times one cannot get or manipulate data across frames.
-
Mar 14th, 2003, 06:44 AM
#4
Frenzied Member
Oh sorry after reading that last post I think you're trying to submit a form in another frame, is that correct? If so then I'd use the frames array, but instead of using an integer, I'd use the name of the frame:
Code:
frames['frameName'].document.form1.submit();
Or if you mean you want to have the current for sumbit, and show the results in another frame just give the form a target attribute:
Code:
<form action="page.php" target="frameName">...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|