PDA

View Full Version : Submitting a form into iframe (SSI script)



CJ-real
04-19-2008, 10:26 PM
I got this to work before then accidentally deleted the file... it is possible but I forgot how!

1) Script Title: Iframe SSI Script 2

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

3) Describe problem: I have a form, which looks like this:


<form name="login" method="post" action="login.php?try=true">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="2"><span class="formtags">Username</span><br>
<input name="username" type="text" id="username"></td>
</tr>
<tr>
<td colspan="2"><span class="formtags">Password</span><br>
<input name="password" type="password" id="password"></td>
</tr>
<tr>
<td width="78"><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</form>

It submits the login information and I want it to submit into the SSI iframe, as if it were a normal link (which DynamicDrive provided this code:
<a href="javascript:loadintoIframe('myframe', 'external.htm')">Link</a>

I have tried the following (to make it easier, I cut off the un-needed code):
1.
<form name="login" target="mainframe" method="post" action="login.php?try=true">
2.
<form name="login" target="mainframe" method="post" action="javascript:loadintoIframe('mainframe', 'login.php?try=true')">
3.
<form name="login" method="post" action="javascript:loadintoIframe('mainframe', 'login.php?try=true')">

I would like to note that the following code:
<form name="login" method="post" action="javascript:loadintoIframe('mainframe', 'usersystem/login.php?try=true')"> works but seems to clear all of the data.

I also remember that what I did wasn't complex. Although I have tried putting the javascript in the target tag, it didn't work. If you can suggest how to make this work, I'll say wether I've tried it or not.

I also remember changing the attributed "id" and "name" of the iframe tag. But I tried all combinations and no luck.

Thanks for your time.

Regards,
CJ-REAL

jscheuer1
04-20-2008, 05:23 AM
There are probably various ways to do this. In the one that springs to my mind at the moment, the iframe should have a name. It can be the same as its id, so something like so:


<iframe id="mainframe" name="mainframe" . . . .

Once you have that, this should work:


<form name="login" target="mainframe" method="post" action="login.php?try=true">

CJ-real
04-20-2008, 11:40 AM
Cool, thanks.

I thought I tried this on number #1 of my list...

Thanks for your time.

williamstam
05-22-2008, 07:45 AM
id="mainframe" name="mainframe" need the "name" tag

i also tried all the above lol... once i added the name thing in it worked