/    Sign up×
Community /Pin to ProfileBookmark

Need help passing variables from iFrame form

I am trying to pass variables from a form that is located in an iframe back to a page that I can control on my Cold Fusion server. I have a button that will pass the variables back to my page using a hidden form. However, the “trick” is that they don’t want the button to show up until the search page returns 0 results (in the iFrame). And on that page the form is not available.

Is there a way to pass the variables from the previous page in history? If not, is there a way to jump back in history and “auto-submit” the form? Below is my page that shows how I am passing the values currently. In the iFrame there is a form named “form1” with one of the fields named “OAL”. So I only want the button to show up when that field is not available because that means their form values didn’t return results but I need to pass the variables from the previous search page.

[SIZE=1]<script language=”JavaScript” type=”text/javascript”>
function showmevalue()
{
var OAL;
OAL = parent.iframe1.document.form1.OAL.value;
document.newform.OAL.value = OAL;
}

<body>
<FORM METHOD=”LINK” ACTION=”http://acweb07.mw.na.cat.com/pcat/comporder/CRIS_main.cfm” name=”newform”>
<INPUT TYPE=”hidden” NAME=”OAL”>
<input type=”button” name=”dotest” value=”show me” onClick=”javascript:showmevalue();”>
</FORM>

<iframe name=”frame1″ ID=”iframe1″ style=”border:none; width:800px; height:900px;” src=”http://acspc01.acric.cat.com/cgi-bin/SPC_Search_subClassSearch.cgt?KEYWORD_ID=4&userMode=NewSearch”></iframe>

</body>[/SIZE]

I’m not very good at javascript to be honest but any help would be greatly appreciated.

Thanks!!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorJul 13.2005 — It looks like your parent and your iframe belongs to different domains. If so, there is no way to use javascript for that, as cross-domain reference it is not possible, for obvious security reasons.
Copy linkTweet thisAlerts:
@Remi32authorJul 13.2005 — Actually, my page is on the same domain because I ran into that "security" problem. It just forwards the information to a different domain. The page I posted really is http://acspc01.acric.cat.com/CRIS_Integration/cris_spc.htm. Getting the data from the iFrame is working but trying to keep the button hidden until they get no results is not.

Thanks!
×

Success!

Help @Remi32 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...