This topic is locked

CUSTOM EMAIL BUTTON

3/11/2009 5:05:37 PM
ASPRunnerPro General questions
B
bhicks11 author

I would like to have a button to email a notification to the customer if we want. Not automatically but if we want. Has anyone done something like this?

J
Jane 3/12/2009

Hi,
where do you want to add this button?

B
bhicks11 author 3/13/2009

Hi,

where do you want to add this button?


Hi Jane,
I would like two different things if possible. If not one of these would be great. I would like to click a button to run this (which is in the Before Update event):
Dim dkeys
message ="This is an auto-nofication that your ONLINE NPDES LOG BOOK has been updated. " & vbcrlf & vbcrlf
message = message & "Please login to your project at www.jvgconsult.com/NPDES/login.asp, print the new document and include in your on-site hard-copy log book. " & vbcrlf & vbcrlf
message = message & " Item: " & strTableName & vbcrlf & vbcrlf
dkeys = dict.keys

'For n = 0 To dict.Count-1

message = message & " Document: " & dict("Document") & vbcrlf & vbcrlf

'Next
message = message & vbcrlf & vbcrlf & "Jonathan Hicks, PE" & vbcrlf & "JVG Engineering, Inc." & vbcrlf & "www.jvgconsult.com"; & vbcrlf
email="hicks237@bellsouth.net"

subject="ONLINE NPDES LOG BOOK AUTO NOTIFICATION"
sendmail email, subject, message
BeforeAdd = True
The second thing would be a button that opens an outlook email with the address from a field.
Thanks very much for any help.

B
bhicks11 author 3/13/2009

I would like to have a button to email a notification to the customer if we want. Not automatically but if we want. Has anyone done something like this?


Sorry I forgot to answer your question: an email button on the List page would be nice.

J
Jane 3/13/2009

Hi,
here are some tips:

  1. proceed to the Visual Editor tab
  2. turn on HTML mode, find this line:
    {BEGIN delete_link}



and add following code just before:

<A onclick="frmAdmin.a.value='update'; frmAdmin.submit(); return false;" href="#">email</A>


And add some code to theBeforeDeleteevent:

'Delete selected records

if Request.Form("a") = "delete" then

BeforeDelete = True

exit function

end if
'email selected records

if Request.Form("a") = "update" then

'send email here

'select values are in the deleted_values array

BeforeDelete = False

end if

B
bhicks11 author 3/13/2009

Hi,

here are some tips:

  1. proceed to the Visual Editor tab
  2. turn on HTML mode, find this line:
    and add following code just before:
    And add some code to theBeforeDeleteevent:


Just to be sure: I am trying to send the email when I ADD an item. Should I put this BEFOREDELETE or BEFOREADD?

Thanks.

B
bhicks11 author 3/13/2009



Just to be sure: I am trying to send the email when I ADD an item. Should I put this BEFOREDELETE or BEFOREADD?

Thanks.


I got this error:
Microsoft VBScript compilation error '800a0400'
Expected statement
/NPDES/include/APPROVED_EROSION___SEDIMENT_CONTROL_PLAN_events.asp, line 224
<A onclick="frmAdmin.a.value='update'; frmAdmin.submit(); return false;" href="#">email</A>

B
bhicks11 author 3/13/2009

Hi,

here are some tips:

  1. proceed to the Visual Editor tab
  2. turn on HTML mode, find this line:
    and add following code just before:
    And add some code to theBeforeDeleteevent:


I had the problems below -- maybe I replied to myself in the forum. Is it possible to just put an EMail button on the ADD page that will open an outlook email?
Thanks.

Sergey Kornilov admin 3/13/2009

Simple email hyperlink is a part of HTML standard.
You can add this in Visual Editor (html mode)

<A HREF="mailto:professorname@departmentwebsite.edu?subject=Question">Question for professor!</A>
B
bhicks11 author 3/14/2009

Simple email hyperlink is a part of HTML standard.

You can add this in Visual Editor (html mode)

<A HREF="mailto:professorname@departmentwebsite.edu?subject=Question">Question for professor!</A>


Thank you Sergey.

  1. Can I make it a button or run from clicking a button?
  2. Also, how do I make the mailto a field in a table?
    Thanks again.

J
Jane 3/16/2009

Hi,
please see my answers below:

  1. here is a sample for button:
    <input type=button class=button onclick="mailto:professorname@departmentwebsite.edu?subject=Question" value="Question for professor!">


2. I'm not sure that I understand your question.

Do you want to select email from database? Please clarify.

B
bhicks11 author 3/16/2009

Hi,

please see my answers below:

  1. here is a sample for button:
  2. I'm not sure that I understand your question.

    Do you want to select email from database? Please clarify.


Hi Jane,
Yes - I want to send it to a receipient's emain in one of the tables. I have a routine in the BeforeUpdate event but would like to only have it fire if the button is clicked rather than every time an item is added.
Thank you for the help.

J
Jane 3/16/2009

Hi,
to select value from database use custom event (Insert ASP code snippet option on the Visual Editor tab).

Here is just a sample:

str = "select FieldName from TableName"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

Response.Write "<input type=button class=button onclick=""mailto:" & rstmp("FieldName") & "?subject=Question"" value=""Question for professor!"">"

rstmp.close

set rstmp=nothing

B
bhicks11 author 3/16/2009

Hi,

to select value from database use custom event (Insert ASP code snippet option on the Visual Editor tab).

Here is just a sample:


Hi Jane,
I'm sorry to be a pest but: where would I put this exactly? Do I also need to place a button on the page?
Also, would there be anywhere to put an IF statement around the Send Email event that is built into the BeforeUpdate event and have it run? It works well for me just don't want it automatic - want to decide whether I want it to go or not.
Thanks Jane.

Sergey Kornilov admin 3/16/2009

Use "Insert ASP code snippet" button in visual editor and paste this code there.
You can add IF ... END IF around this code to display this button only when you need it.