Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2004, 03:33 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use of one jscript fn, 1 VB fn on Button click

Dear friends,

I have to check the values of feilds,if field value is empty then
i have to give messge like 'Pl.. enter the login name' in use alert message like popup window whenever i click the button.
if all fields entered then it's go to save.
 I tried for this it's working fine to one function, but after checking the fields i called one more function i.e., in VB function, then two functions are not working.

1. javascript fn
<script LANGUAGE="JavaScript">
function valid()
{

if (alertSubmit1() && alertSubmit2())
   {
     document.frmlogin.submit();

   }
}

function alertSubmit1()
{
var str = document.Frmlogin.loginname.value
if (str=="")
{
    alert("Enter your Login ...")
    document.Frmlogin.loginname.focus()
    return false
}
else
{
    return true
}
}
function alertSubmit2()
{
var str1 = document.Frmlogin.passwd.value
if (str1=="")
{
    alert("Enter your password ...")
    document.Frmlogin.passwd.focus()
    return false
}
else
{
    return true
}
}
</script>

2.vb function to save the data

here i given at button
onclick="valid" onserver click="save"

so, here it's saving but not checking the empty fields

please help me here what i have to do..

thanks in advance
I need a step by step, work thru this process...

thank you
 
Old January 9th, 2004, 12:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Why not use requiredfieldvalidators. They add the Javascript for you. You can also use the validationsummary control to list all errors on the form.

 
Old January 12th, 2004, 03:41 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

we can use onclick and onserverclick events at the same time?

if it's there please tell me how to do it.
thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
click event for vb YesNo button mohiddin52 Access VBA 2 January 14th, 2007 02:25 AM
how to use Excel VB to click a button which is!! tappenchris Excel VBA 0 November 30th, 2006 12:07 AM
How to Click a web button using VB code AJD Access VBA 6 June 6th, 2006 07:32 AM
How to Click a button on a web page in VB code AJD Beginning VB 6 0 June 2nd, 2006 12:08 PM
A button to click from vb, on webbrowser object !! mmd VB How-To 2 January 19th, 2004 07:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.