Forum Moderators: open

Message Too Old, No Replies

Dual Function 'Submit' Button

         

rlwillis

11:28 pm on Jan 31, 2004 (gmt 0)



How do I make one Submit button do two things. I have 'Print' code and 'email form' code on the page. I want the form page to print and and the form inputs to be emailed with one button. The email code only works with a second 'Submit' button on the page. I tried a hidden submit function but that isn't working. Thanks for any help.

RonPK

12:52 pm on Feb 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Write a script that 'onSubmit' first prints the page, and then submits the form. I haven't tested this, but it might work:

<script type="text/javascript">
function printAndMail(theForm) {
window.print();
theForm.submit();
}
</script>
...
<form action="..." onSubmit="printAndMail(this); return false">