[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

prevent  multiple form submission

Posted on 2006-06-22
2
Medium Priority
?
212 Views
Last Modified: 2010-04-23
I have a 1 btnSubmit button that sends an email. users do multiple clicks and we receive all emails. How to avoid this? I did a research and tried a few codes but non of them worked.

This is my code for the button:

-------------------------------------------------------

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

        Try
            Dim objMail As New MailMessage
            objMail.From = "email1"
            objMail.To = "email2"
            objMail.Subject = "Form"
            objMail.BodyFormat = MailFormat.Html
         
            objMail.Body = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbCrLf _
                & "<body>" & vbCrLf _
                 & "</body>" & vbCrLf _
                & "</html>" & vbCrLf

            SmtpMail.SmtpServer = "192.100.00.104"

            SmtpMail.Send(objMail)

        Catch ex As Exception
         
            lblError.Visible = True
            lblError.Text = ex.Message

        End Try

-----------------------------------------------------------------------------------------


thanks,
0
Comment
Question by:ainaks25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:ainaks25
ID: 16963301
I found the solution:

<SCRIPT language=JavaScript > 

var submitcount=0;

function checkSubmit()
{

if (submitcount == 0)
{ submitcount++; return true; }
else
{ alert('This form has already been submitted.' ); return false; }

}

</SCRIPT>       



and

<form id="Form1" name="MainForm" method="post" runat="server" onSubmit=" return checkSubmit();" >


---------------------------
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 16997904
Question closed - 125 points refunded.

Best regards,
RomMod
Experts Exchange
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question