View Full Version : submitting and printing a form

08-21-2002, 02:39 PM
OK, here is my current conundrum.

I have a form which needs a signature but I still want to collect the data in a csv. So what I am after is a way of printing and submitting the form at the same time.

EASY - i hear you cry.

however I have a number of textareas in the form so I am using a strip out special characters script which i have to call aswell and it is this that is causing me angst...

When i try and call both it tells me that my textarea is undefined or null.

The code I am using is as follows:

function printPage() {
if (window.print)
alert("Sorry, your browser doesn't support this feature.");

// -->

<script language="javascript">
<!-- Begin
function whatIsThis() {
document.myform.textone.value = escape(document.myform.textone.value);

and then the submit button is doing the following

<a href="javascript:document.myform.submit();" onClick="printPage();whatIsThis();">
<img src="submit.gif" width="52" height="18" border="0">

I am using a generic form into csv handler so can't write a specific form handler that does exactly what I want.

any solutions?

Do you need further info to help? If so what info do you need?

All help greatly appreciated.


08-21-2002, 04:21 PM
I *may* have a solution for you with a simple change

Instead of using the anchor/image combo for your submit, just use a type=image input, which by default submits the form. And, you should use onSubmit becuase it can be delayed until the function whatIsThis() runs successfully.
function whatIsThis(f) {
f.textone.value = escape(f.textone.value);
return true;

<form onSubmit="return whatIsThis(this);">

[....FORM STUFF....]

<input type="image" src="submit.gif" />