How about this :-
function Printing()
{
window.location = 'printed.asp';
}
And in printed connect to your database using server-side ASP, do the insert, and then
display a message saying something like "page printed successfully".
Because you call window.print before Printing() it will still print the page before it
does the insert and displays the success message.
Dan
www.diado.com
-----Original Message-----
From: marucomartinez [mailto:[EMAIL PROTECTED]
Sent: 22 September 2004 18:26
To: [EMAIL PROTECTED]
Subject: Re: [ASP] Writing to SQL from a jscript using an ASP page
Firstable, thank you. However, let me be more spefic. This is my
code:
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
function printformbtn_onclick()
{
window.print();
Printing();
}
//-->
</script>
1. When the button is clicked it calls the window.print(); to print
the form.
2. Then after it calls the function Printing() to insert to the SQL
database a value indicating that the form was printed.
3. I need to know how to write this code.
function Printing()
{
what code goes here???
}
--- In [EMAIL PROTECTED], Mark E
<[EMAIL PROTECTED]> wrote:
> It might be easier to change the print button to a submit button.
Have it post to itself, executing a SQL command that inserts your
value, then write out the following javascript if you have no errors:
>
> <%
>
> some code to insert your record
>
> if no error occured, break from the code....
>
> %>
>
> <script language=javascript>
> window.print();
> </script>
>
> <%
>
> else
> 'Display an error message or something.
> end if
>
> %>
>
> I did this a long time ago. It's easy and fast, but maybe not the
most elegant solution.
>
> Mark
>
> marucomartinez <[EMAIL PROTECTED]> wrote:
> Dear friend:
>
> Let me explain what I have. I have an ASP page that displays
several
> ASP forms from where any user can select and view a form. Each
form
> has a print button at the bottom of the form. When the user has
> loaded the form for viewing it retrieved the data from a SQL
> database. When the user clicks the print button a call is made
to
> a java script to insert a value to the SQL table so the next time
> another user retrieve the list of ASP forms the listing displays a
> check mark next to the form name indicating that the form was
> previously printed.
>
> My question is how can I write the SQL command within the java
script?
>
>
>
>
>
> --------------------------------------------------------------------
-
> Home : http://groups.yahoo.com/group/active-server-pages
> --------------------------------------------------------------------
-
> Post : [EMAIL PROTECTED]
> Subscribe : [EMAIL PROTECTED]
> Unsubscribe: [EMAIL PROTECTED]
> --------------------------------------------------------------------
-
>
>
> Yahoo! Groups SponsorADVERTISEMENT
>
>
> ---------------------------------
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/active-server-pages/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> [Non-text portions of this message have been removed]
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/