Solved

Stop a submit

Posted on 2008-10-29
1
213 Views
Last Modified: 2008-10-29
Hi
I have an ASP.NET using Visual Basic.Net and I have a form on a page.
I want the form to be check so details when I click submit so I do this ...

btnSubmit.Attributes.Add("onClick", "alert('!!!');return false;")

that works fine. It doesn't submit.

But if I try

btnSubmit.Attributes.Add("onClick", "checkForm();")

and then in the javascript do this

function checkForm()
    {
        alert('test!');
        return false;
    }

It submits!
I can't understand why.

Any ideas?
Thanks
AM
0
Comment
Question by:amoran
[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
1 Comment
 
LVL 15

Accepted Solution

by:
Tomarse111 earned 20 total points
ID: 22829484
Try the below:
btnSubmit.Attributes.Add("onClick", "return checkForm();")

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 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