Solved

Stop a submit

Posted on 2008-10-29
1
206 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
1 Comment
 
LVL 15

Accepted Solution

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

Open in new window

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now