locked
Why my form is sending data twice? RRS feed

  • Question

  • User910997647 posted

    I have this simple form code where the user should fill in his email and submit. Then I have a JS code that will check if the email is valid; if not it will pop an alert with an error, otherwise it will run VB code behind that will save the email to a table in our DB. The problem is that every time the submit button is clicked it is submitting the data twice and therefore it is inserting two new records in the DB. Any idea?

    Saturday, December 15, 2018 6:31 PM

Answers

  • User910997647 posted

    Never mind. I figured it, was a stupidity. I handled my button click with:

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

    instead

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    embarassed

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 15, 2018 6:52 PM