How to email and insert a form in one submit?
-
Hi All, I'm quite new in the world of ASP & Javascript. For the moment I encounter the following problem: I've a form with some textfields which I need to send/submit at the end, this event invokes an email to the requestor & an insert into an access database. Doing both separetely works fine, however I don't succeed in combining both actions with one submit-statement! I've been playing around already since several hours (even days) but till now I didn't find anything that works fine... :( Can some of you provide some help? Best regards, Proxi79
-
Hi All, I'm quite new in the world of ASP & Javascript. For the moment I encounter the following problem: I've a form with some textfields which I need to send/submit at the end, this event invokes an email to the requestor & an insert into an access database. Doing both separetely works fine, however I don't succeed in combining both actions with one submit-statement! I've been playing around already since several hours (even days) but till now I didn't find anything that works fine... :( Can some of you provide some help? Best regards, Proxi79
You should put something like this in your code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'this checks to see if the page has been posted back, i.e. submit has been clicked If IsPostBack Then Try MyInsertFunction() 'calls your insert function MyEmailFunction() 'calls your email function Catch ex As Exception Response.Write(ex) 'if either of the above operations fail, this will tell you the error End Try End If End Sub
Alternately, you can place that try/catch block inside of your submit button click event handler instead of Page_Load. Hope that helps. ------------------- abort, retry, fail?