Display form data on html page

OK, now I know I’m being stupid here, but I am used to using asp or php but this project requires having a locally served html page that has a form that when submitted will show all the information as text - and I’m not sure how to do it!

I could have a print button on the form itself but the problem I have is with textareas, I need to print the scrollable region, among hiding some things from the input page. So say I have a name text field and a comments textarea field and a submit button. I want it to go to another html page that just shows the name and comments as text.

I guess I would be using client-side javascript or vbscript, getting the different field values and writing them on the page? Does anyone have any examples of this, or is there a better way? Thanks.

the form data … could be printed on the resultant page via a CGI program , as in www.worldwidemart.com ( Form Mail) ,

Please excuse my inexperience with cgi-bins, I was under the impression that you need to be using a web server for that. This is a local page. It is being included with software that will be distributed to thousands of people. The end-user may not have internet access. I have found a javascript function where I can get the querystring values so that’s all I need I think.

Just like in asp I just needed to create variables that corrensponded to request.form(“values”) and write it.

HTML only provides the layout of the page . You need some dort of program to respond to the form’s request I am sure .

I got the function here: http://www.btinternet.com/~a_urquhart/request.html

All I am doing is getting the data from the form and displaying it on another page. I could probably do it in vbscript too but just going to go forward. Thanks!

My solution (in the other thread :slight_smile: ) would do what you want, because even though it is one page it views as 2 and will print as 2 as well.

Alternatively you could pop up a new window and then populate it with the form data.

I’m with Dale_burrel on this one.
it would really be easier to do it with one page. I understand that you want it to generate some kind of printable report from the form that the user has just filled in.

you can split the page in two and turn each half on and off whenever you wish so it looks like you have two completely seperate pages. This would really make it much easier for you to grab the data the user has captured and display it in whichever element in the hidden part of the page. then just switch to the report half when you are done and make everything you dont want to print invisible.

and like Dale says. you could have it acting exactly as if you have two completely seperate pages. no reason why you cant have the report half of the page looking exactly like it would look on a ‘actual’ seperate page.

Well, I can see your points. There is going to be other stuff going on behind the scenes, calling a com object that populates some input fields and submitting the form info, not just viewing results, so I don’t know if this would complicate the one-page view. I would guess the javascript function could just do the submitting as well as the displaying though?

Do you have any references on how to split pages into two, show/hide stuff and how to populate it with javascript :confused: I am a little hesitant since I felt like I had this part figured out and it seems like a whole lot more to figure out to get back to this point. Such is life…

Did you want a javascript to do this? If so I may have found one that will do what you want by opening another browser window with the text in it. In other words, someone inputs text in text box and clicks the button, another window opens with that text in it.:slight_smile: Let me know.

Try these. I found two while I was looking.



I already am doing something similar to this, that’s what I meant by getting the function above, but thanks for the links. Another possibly helpful thing for your second link is to add somthing like this before it displays:

textareafield = textareafield.replace(/\
/g, "<br>");

so your line breaks appear…