Time:
Scotland: Sat, 6:42 am
Rhode Island: Sat, 1:42 am
Florida: Sat, 1:42 am
New Mexico: Fri, 11:42 pm
California: Fri, 10:42 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

Selanac Embroidery and Screen Printing

Embroidery
Screen Printing
Signs and Banners
Promotional Advertising

WEBSITE

Contact Paul Canales
TEl: USA 732-901-8417
CELL: USA 732-773-1339


Please click here for more information


For continued disscussion on this topic : Passing two form variables through URL


Cybian
02-05-2002, 11:05 PM
I have done a search on this topic but still haven't found something that I can learn off of.

I was wondering what would be an easy way to pass two text input fields from a form to another popup window. Basically I am trying to "preview" what was entered in the fields before the form is submitted. On of the form inputs is a textarea so the content can be quite large.

I'm just looking for a way to pass what was typed into the form fields and view them on another page. Is there a simple way in doing this? Thanks in advance.

diades
02-05-2002, 11:39 PM
Hi Cybian

Try this link in the "Frequently asked questions" section:
http://www.webxpertz.net/forums/misc.php?s=&action=faq&page=5#qj7

Cybian
02-06-2002, 12:05 AM
The problem is that I am not seeing the variable being passed over. I have read lots of different ways from previous threads which is why I don't even know where to begin. It almost seems the same thing is being done different ways. But known seem to work. I have a simple function for the popup:

<SCRIPT LANGUAGE="JavaScript">
<!--
function OpenWindow(url) {

link =
window.open(url, "Link","toolbar=0,location=0,width=400,height=300,scrollbars=0,menubar=0,resizable=1,left=180,top=180");
}
// -->
</SCRIPT>

The problem is in the button that I am creating that should be passing the two variables from the form:

<input type="button" value="Preview" onClick="OpenWindow('affiliate_preview.cfm?Title=this.form.Title&Content=this.form.Content');">

Now this is scaled way down because this was the example given.

I've tried different versions of this: onClick="OpenWindow('affiliate_preview.cfm?Title="+document.TheForm.Title"&Content="+document.TheForm.Content"')"

lorddog
02-06-2002, 02:10 AM
you cant have " inside the onClick="stuff" they need to be '

onClick="OpenWindow('affiliate_preview.cfm?Title='+document.TheForm.Title+'&Content='+document.TheForm.Content);"

that looks better. you were also missing an +

you can test it by placing an alert in your function

function OpenWindow(inString){
alert(inString);
... more stuff
}

Cybian
02-06-2002, 07:54 PM
Thanks for your help lorddog. Just a quick background of me is that I have a ColdFusion background. I can do this in CF and pass and retrieve stuff through the URL but doing in JavaScript is totally new to me. I don't get an error now on my first page. This is what is being passed through the URL now. http://www.mysite.com/maintenance/affiliate_preview.cfm?Title=[object]&Content=[object]. Is this correct?

Also since I am used to pulling data from the URL using CFML, I'm not sure how to do it using JavaScript. Basically what I am doing is when you preview your post in most forums. Thought it would be a great addition in a content management system. I need the user to see what they are about to post to the web site before they submit it to the database which when then by live on the site.

This seems to be more in line in what I am trying to accomplish. At least the URL sees them as objects.

lorddog
02-06-2002, 08:28 PM
maybe try adding .value after title and content

Lorddog

Cybian
02-06-2002, 09:02 PM
That was it! Thank you so much! You don't know how many variations I have written that OnClick code. Works perfect. And I could still use CFML to pull the data from the URL which is easy.

Just a quick question. Is there a set number of characters that can be sent when using a URL to pass information? I read a thread that someone said there is ... but didn't give a set number (i.e 6000 characters).

I'm posting the correct code below for FYI to all interested.

//first page

<SCRIPT LANGUAGE="JavaScript">
<!--
function OpenWindow(url) {
link =
window.open(url, "Link","toolbar=0,location=0,width=400,height=300,scrollbars=0,menubar=0,resizable=1,left=180,top=180");
}
// -->
</SCRIPT>

<FORM ACTION="affiliate_action.cfm" METHOD="post" NAME="TheForm">
<INPUT TYPE="text" NAME="Title" VALUE="<CFOUTPUT QUERY="GetDetails"> #Title#</CFOUTPUT> " SIZE="25">
<TEXTAREA COLS="47" ROWS="20" NAME="Content"><CFOUTPUT QUERY="GetDetails"> #Content#</CFOUTPUT> </TEXTAREA>
<input type="button" value="Preview" onClick="OpenWindow('affiliate_preview.cfm?Title='+document.TheForm.Title.value+'&Content='+document.TheForm.Content.value);">
</FORM>

//second page (affiliate_preview.cfm)

<CFOUTPUT>
#url.Title#
#url.Content#
</CFOUTPUT>

Thanks again for all your help!

lorddog
02-06-2002, 09:05 PM
yes there is a set amount for posting and querystring.
although I dont know what the limits are for each.

Lorddog