/    Sign up×
Community /Pin to ProfileBookmark

Previewing contents of form in a popup window..

Hey,

What Im interested in doing is previewing the contents of three form fields in a popup window which would be seen once the user hits a “preview” button on the form entry page. Ive found a pretty neat script at

[url]http://javascript.internet.com/forms/html-preview.html[/url]

which does the job and displays the form values in this new popup window, but that window gets stuck on loading halfway and just stays there. I guess I could live with this but its annoying and I wanna know why its doing that. Also, Id prefer this popup window to open in another html page which would already have the layout I want to wrap the 3 form values in. This I have no clue how to achieve. Id have to find some way to pass those form values over to this new html page.

Any ideas?

Thanks!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@mkosmosportsauthorApr 11.2007 — *bump bump*?

Judging from the silence Im guessing this sounds like its impossible without some server-side script?
Copy linkTweet thisAlerts:
@Mr_JApr 11.2007 — Give this a try


[B]main page[/B]
[CODE]<HTML>
<HEAD>
<TITLE>Form Method</TITLE>
<script type="text/javascript">
<!--
function sendme(){
myString = document.form1.textfield1.value+"="+document.form1.textfield2.value
newWin=open("popup.htm?" + myString,'win1','left=300,top=200,width=300,height=300')
}
//-->
</script>


</HEAD>
<BODY>
<form name="form1">
textfield1 <input type="text" name="textfield1" value="Hello">
textfield2 <input type="text" name="textfield2" value="World">
<input type="button" value="Send" onclick="sendme()">
</form>


</BODY>
</HTML>

[/CODE]


[B]popup.htm[/B]

[CODE]<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
<script type="text/javascript">
<!--
var dataPassed = ''

function getData(){
if (location.search.length > 0){
dataPassed = unescape(location.search.substring(1))


tempArray=dataPassed.split("=")
document.form2.textfield1.value=tempArray[0]
document.form2.textfield2.value=tempArray[1]
}
}

//add onload="getData()" to the opening BODY tag

//-->
</script>


</HEAD>
<BODY onload="getData()">
<form name="form2">
textfield1 <input type="text" name="textfield1" value=""> <br>
textfield2 <input type="text" name="textfield2" value="">
</form>


</BODY>
</HTML>[/CODE]
Copy linkTweet thisAlerts:
@mkosmosportsauthorApr 12.2007 — Thanks Mr.J!

Ive modified your proposed script a little and now it works just the way I want it to...
×

Success!

Help @mkosmosports 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.14,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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