Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form preview before sending?

Status
Not open for further replies.

toias

IS-IT--Management
Sep 4, 2002
19
SE

I'm trying to make a form with a few checkboxes and a preview button. I want the preview button to open a new window with the formresults an empty textfield (for sender email) and a submit button that will send the data as a formmail. I'm so out of ideas!
 
Toias...

In your form declaration, include target="_blank". Example:

Code:
<form name=&quot;myForm&quot; method=&quot;post&quot; action=&quot;nextpage.asp&quot; target=&quot;_blank&quot;>

Now, when yiou submit the form, it will be submitted in a new window. The file nextpage.asp would then be able to process your initial submission, present the data on the screen (or in hidden fields of the next form) and present the user with the text field and another submit button.

Clicking this next submit button would submit the new form to some page... whiich might return an html page with something like: Your form was sent. Click here to close the page.

Just some thoughts,
Jeff
 
You got the idea right but ...


... do I have to use asp (read learn asp)?

... and when I tried this earlier all the formdata ends up in the adressfield of the new window (?)
 
Toias,

It is possible to use an .html file insteal of .asp (or indeed many file types). I used .asp in my example because it's a common choice for web development.

So let's assume you choose to have the data sent to a .html called nextpage.html:

Code:
<form name=&quot;myForm&quot; method=&quot;post&quot; action=&quot;nextpage.html&quot; target=&quot;_blank&quot;>

This page will need to grab the different form fields that were submitted to the page (using Javascript) and then set these values into hidden fields (again using Javascript - but waiting for the page to finish loading before attempting to access the form elements) and/or display the values on the page as if they were text (again you would use Javascript - you could use document.write(), or you could set innerHTML/innerText if the target browsers supported it).

The next thing the user types is an email address in the text field and clicks the submit button (I guess to send this data to an email address).

Many questions arise. What mechanism are you going to use to actually perform the sending of this email? You can't just &quot;click the button and have it sent&quot; without incorporating some kind of server-side solution.

You could use ASP and CDONTS (a module for IIS), JSP and JavaMail, Formmail... the list is long... but there is no plain HTML option.

It is true that you can click a hyperlink and &quot;send an email&quot; on many webpages around the internet... but these hyperlinks merely send some (small amount of) data to the user's email program... the user still has to then switch to the program and (at the very least) click the send button. You can certainly set the To address and the Subject field of such emails... but I doubt this is the solution you are looking for.

If you decide to use html to code the second page, then I suggest you investigate if your hosting ISP offers a &quot;mail cgi or formmail&quot; option. If so, you can submit the contents of the &quot;preview&quot; html to the cgi or formmail script (with the only learning curve being learning how to use the supplied cgi etc. If they offer no such mechanism, then I suggest you move ISPs.

Is this how other people on the forum would deal with this problem? I'm curious to hear other &quot;real world&quot; solutions.

Jeff
 
Thanx for all your help - I'm a bit closer now - and yes I'm going to use a formmail to send the final version of the form.

If you have the time please take a look at and se if you can figure out why alll the data dosent apear in the preview.

/Thanx
 
Worked fine for me... I selected a checkbox and typed a comment... then clicked the button. A new window popped open, and when I went view source I saw the values that I had typed in the previous page.

It looks like you've got it all set up fine from what I caan tell. The only possible thing might be to check the names that you give your form elements on the pop up page... just make sure they map to the formmail fields correctly.

I didn't click send on the pop up page... it looked as if you had the code working by then.

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top