ASP.NET 1.1 & Javascript Validation: Return false but server code still runs!?!?

Posted on 2006-05-04
Last Modified: 2012-05-05
Hey Experts,

I'm attempting to validate an form by way of a javascript function. The problem is this:
Even though my jscript function returns false, the server side code still runs.  

My JScript is being called like this:

btn_save.Attributes.Add("onClick", "checkvals();")

To troubleshoot, I reduced the javascript to it's simplest possible form:

function checkvals()
return  false;

When I click the button, the alert pops up, I click okay and then the server side code runs.

What's going wrong here???

Thanks in advance,

Question by:RunForrestRun
    LVL 25

    Accepted Solution

    need to add return:

    btn_save.Attributes.Add("onClick", "retirn checkvals();")


    Author Comment

    Thanks Nauman . . . that's a quick and easy 500pts for you . . . . . much obliged.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now