Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnClick Event triggering an automatic email

Status
Not open for further replies.

gio2888

Technical User
Oct 26, 2000
64
US
I have two input type buttons, one approve and the other is disapprove. When clicked on either one, it will call a function which will send an email. My question is how do I trigger the function?

<input type = &quot;button&quot; value = &quot;Approve&quot; name = &quot;Approve&quot; onClick =?>

<input type = &quot;button&quot; value = &quot;Disapprove&quot; name= &quot;Dispprove&quot; onClick = ?>

<%
function mail_to_sponsor(form_results)
set mailobj = server.CreateObject(&quot;CDONTS.newmail&quot;)
mailobj.From = &quot;wip@caregroup.harvard.edu&quot;
mailobj.To = request(&quot;Sponsor_Email&quot;)
mailobj.subject = &quot;Information Systems Project Request&quot;
mailobj.Body = &quot;Your request has been approve!&quot;
mailerResult = mailobj.send()
end function
%>
 
You have to send the server notification of the onclick event that is happening on the client. Either do this by sending querystring info or form info
ie:
[asppage.asp]
<%
if request.querystring(&quot;Email&quot;)=&quot;Approve&quot; then

function mail_to_sponsor(form_results)
set mailobj = server.CreateObject(&quot;CDONTS.newmail&quot;)
mailobj.From = &quot;wip@caregroup.harvard.edu&quot;
mailobj.To = request(&quot;Sponsor_Email&quot;)
mailobj.subject = &quot;Information Systems Project Request&quot;
mailobj.Body = &quot;Your request has been approve!&quot;
mailerResult = mailobj.send()
end function

elseif request.querystring(&quot;Email&quot;)=&quot;Disapprove&quot; then
...
else
...
end if
%>

<input type = &quot;button&quot; value = &quot;Approve&quot; name = &quot;Approve&quot; onClick=&quot;window.location.href='asppage.asp?Email=Approve'&quot;>

<input type = &quot;button&quot; value = &quot;Disapprove&quot; name = &quot;Disapprove&quot; onClick=&quot;window.location.href='asppage.asp?Email=Disapprove'&quot;>



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top