Solved

Stop a submit

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

Open in new window

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

776 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