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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Form Data to another Printable Web Page

Status
Not open for further replies.

coman

MIS
May 24, 2002
7
IE
I have an order form on a web page and i want to have people fill it in then i want to be able to click a "print form button" and have the information sent to another simply formatted web page for printing. Can someone show me how to get the information to the printable web page.

Thanks
 
I have tried the script you have mentioned but it creates a new window each time with plain text from the form fields. I need to have a formatted web page that has some design features such as company logo etc. Can this code be modified to allow me to use a designed web page and place the text from the fields into this page?

Thanks
 
Sure!
Use [tt]document.write(''); [/tt] to enter any html code you need:


newWin.document.write('<html><body onload=print()>');
newWin.document.write('<img src=&quot;something.gif&quot; width=&quot;100&quot; height=&quot;90&quot; alt=&quot;logo&quot;>');

newWin.document.write('<!-- some other html stuff -->');

and then place the code for form fields,
and don't forget to close the document stream at the end:

newWin.document.close();


Also don't forget about nested quotes:
document.write('<form name=&quot;f1&quot; onsubmit=&quot;alert('Some message')&quot;>')


good luck
 
Starway's solution is technically sound but the reason for doing such a task enerves me.

Why do that in the first place? Why not have a confirmation page after submit with nicely formatted HTML?

If you are limited to JavaScript only you could also use cookies and on the next page get the value of the cookies to insert inside your nicely formatted table.

But if you have an order form and no access to server side technologies do you send credit card info unencrypted over the net? Lots of user don't dare do such a thing. Gary Haran
 
Hi xutopia.....What i have is a
1. Sales order Form
2. This uses a cookie based shopping cart to enter product description & pricing onto another web page which is the Sales Checkout form.
3. This Checkout form has been nicely formatted with logos etc but there is too many graphics and other information to just go ahead and print this complete web page as the orderform.

So what i need to do is have a script or somehow modify the original cookie based shopping cart script that can print an order-form that includes the product details, price, delivery information and credit card details so i can process the order manually....not over the net. An order form with the same info as the Sales checkout form but with less graphics and information.
 
Hi xutopia.....What i have is a
1. Sales order Form
2. This uses a cookie based shopping cart to enter product description & pricing onto another web page which is the Sales Checkout form.
3. This Checkout form has been nicely formatted with logos etc but there is too many graphics and other information to just go ahead and print this complete web page as the orderform.

So what i need to do is have a script or somehow modify the original cookie based shopping cart script that can print an order-form that includes the product details, price, delivery information and credit card details so i can process the order manually....not over the net. An order form with the same info as the Sales checkout form but with less graphics and information.
 
Can someone please offer any help with this problem??
 
To say truth, I don't understand why my suggestion isn't good enough for you.
It was used for the same purpose once and we didn't have any problems.
 
starway you have great technical knowledge of javascript and I don't deem your solution not good enough. Actually I'd give you a star if I had a problem and you came up with a solution like yours.

What I dislike is using JavaScript for things that it just wasn't meant to do or that other technologies do far better(I am saying that despite JavaScript being my language of choice). For example having an order form can be improved using JavaScript but created from scratch and doing everything with JavaScript is not always the fastest most cost effective solution for an online store.

My concern is that if coman wants to sell things online he needs people to trust his site. Popups of any sort tend to discourage buyers except if it is made understandable for the end user a popup is in most cases very annoying. If he does need to use only JavaScript (no access to server side tech like PHP) a popup link could be improved using a warning for the user :

&quot;open easy print page in new window&quot;

rather then :

&quot;print page&quot;

But what I would like to stress is that big web sites selling tons of merchandise who have spent money on usability studies show that streamlining the process is a good way of making the user confortable.

When you go to the store at the mall. Let's say Future Shop to buy a new remote control for you TV. You could break down in steps what you do.

- arrive at store,
- go to TV remote section,
- choose a remote (using the lower-price-tag technique),
- bring it to cashier,
- see the total amount displayed one last time (just in case),
- pay for the item,
- leave with receipt
- arrive home and watch TV

Now you would not like it if you had to go through these steps now would you :

- arrive at store,
- go to TV remote section,
- choose a remote (using the click-to-find method),
- bring it to cashier and leave item there so that you can go elsewhere and verify the total amount,
- come back from verify price section,
- pay for the item,
- wait two weeks before receiving your remote
- turn off computer and walk to tv to turn on.

Internet automatically means you have to wait for the item to arrive. That is something you can't change. It's not as gratifying as buying the item in the store.

Streamlining the process is the way to go. When buying online you should have well delimited visual cues for your users and as little as possible deviation from the transaction. After all if you want to sell something you should make it as simple as possible for people to do so. It is to your advantage.

here is what I recommend :

- arrive at store
- home page has the lowest price of each section displayed, select the remote with VCR,TV,
- when you click on it you arrive at spec sheets, you like what you see,
- click on one of the two &quot;buy right away&quot; buttons (one on the top of the page and one at the bottom because that is where people would look),
- fill in credit card info because Internet Explorer told you it was secure to do so,
- click &quot;confirm purchase&quot;,
- get order number in an easily printable version (acts as a receipt).
- of course wait for delivery.

Using PHP this would be very easy, ASP too I imagine. But using solelly JavaScript the end user will feel as though something is weird.

You see that printing here occurs at the end once everything is done and confirmed like when you go to the store, you get the printed receipt only after you buy. To me that seems normal and that means I will buy. Gary Haran
 
xutopia,
First of all, you are absolutely right about using technologies for right purpose and usability issues. I sign up under every word of yours.

I also always say that programming is the last thing you should start with, and the logiñ research and process planning is the very first step.

But in this very case, as far as I understood the question, nobody spoke about using javascript in the middle of the purchase process, this is mindless idea.

coMan needed to print the order page after the order has been already placed and all data was extracted from database using server-side system.
This is the very last step of purchase process that you described in details. It seems to be unnecessary to create new calls to database just for printing the result values - in this case you're going to make the same job twise.

Those values have already been sent to client and appropriate page is already generated, the order process came to an end. Now what user may want is to make a hardcopy of his order report. It seems to me that the small script I proposed is the most logical and easy solution.

It's my pleasure to communicate here with such persons.
good luck
 
Hey guys......i think you have the wrong idea...........I am not running the shopping cart on the Internet.............this is on a CD.......I want to give shoppers the opportunity to buy from a shopping facility built into the Web Site on CD..........I use the cookie based shopping cart because it totals the purchases and send the info to the shoppingcart page.......it's this page that i need to print without so much graphics and sales information.........So i need to be able to somehow send selected data to a printable page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top