...

View Full Version : submitting and printing a form



Richsparov
08-21-2002, 01: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:
<SCRIPT LANGUAGE="JavaScript">
<!--

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

// -->
</SCRIPT>

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

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">
</a>

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.

Regards
Richard

beetle
08-21-2002, 03: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);
printPage();
return true;
}

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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum