/    Sign up×
Community /Pin to ProfileBookmark

targetting a form to an iframe

Hello

I am trying to use remote scripting in my page and I ran into several problems.
My page is defined like so:

[code]
<html>
<body>
<form name=”myForm” method=”post” action=”target.html” enctype=”multipart/form-data” target=”RSIFrame”>
<input type=”text” name=”text”></input>
<input type=”file” name=”file”></input>
<input type=”submit” value=”submit”> </input>
</form>
<iframe id=”RSIFrame” name=”RSIFrame” style=”width:0xp; height:0px; border:0px;”></iframe>
Text
</body>
</html>
[/code]

taget.html is defined like so:

[code]
<html>
<head>
<script type=”text/javascript”>
<!–
function processData() {
window.parent.alert(“back”);
}
// –>
</script>
</head>
<body onload=”processData”></body>
</html>
[/code]

I am trying to cause the form to be submitted via the “hidden iframe”. Once a response will return from the server in taget.html, a message should be displayed in the original window.

I have 2 problems:
1) The iframe is indeeded hidden, but still takes a space in the original window (note the ‘Text’ being displayed right after it). I would like to make it completely invisible. I heard that if I gave it the style: display:none, it will not work properly.
2) For some reason I am not getting the alert message to appear. I am not sure what the problem is. Maybe the form is not being submitted, or maybe the onload event is not triggered in target.html

please help

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @davidklonski spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...