Click to See Complete Forum and Search --> : Previewing contents of form in a popup window..


mkosmosports
04-11-2007, 07:12 AM
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

http://javascript.internet.com/forms/html-preview.html

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!

mkosmosports
04-11-2007, 11:40 AM
*bump bump*:)

Judging from the silence Im guessing this sounds like its impossible without some server-side script?

Mr J
04-11-2007, 12:43 PM
Give this a try


main page
<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>



popup.htm

<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>

mkosmosports
04-12-2007, 02:02 PM
Thanks Mr.J!

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