Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Stop a submit

Posted on 2008-10-29
1
Medium Priority
?
223 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 80 total points
ID: 22829484
Try the below:
btnSubmit.Attributes.Add("onClick", "return checkForm();")

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

972 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