473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Validating two textbox controls

Im trying to do a function to validation two textbox controls. I want the
user to enter in text to either txtSurname or txtCompanyName but not both. Is
my logic wrong and if so can someone help me change this to achieve my goal.
Im really terrible at this and am under pressure to get it done so any help
at all would be appreciated.

function ValidateSurnameCompanyEntered(sender, args)
{
var txtSName = document.WebForm2.txtSurname;
var txtCompName = document.WebForm2.txtCompanyName;
args.IsValid = ((txtSName.text.length>0 && !(txtCompName.text.length < 0))
|| txtSName.text.length> 0 && (txtCompName.text.length < 0));
}
Jul 21 '05 #1
1 1051
Stephen,

The only thing you have to know is if the textbox lenghts are both longer
than 0 than it is an error in your case.

However probably you will as well not that they both are equal to 0.

This is a general newsgroup, when it is a code question, than the newsgroup
microsoft.public.dotnet.languages.csharp is probably a better place.

I hope this helps?.

Cor

"Stephen" <St*****@discussions.microsoft.com>...
Im trying to do a function to validation two textbox controls. I want the
user to enter in text to either txtSurname or txtCompanyName but not both.
Is
my logic wrong and if so can someone help me change this to achieve my
goal.
Im really terrible at this and am under pressure to get it done so any
help
at all would be appreciated.

function ValidateSurnameCompanyEntered(sender, args)
{
var txtSName = document.WebForm2.txtSurname;
var txtCompName = document.WebForm2.txtCompanyName;
args.IsValid = ((txtSName.text.length>0 && !(txtCompName.text.length < 0))
|| txtSName.text.length> 0 && (txtCompName.text.length < 0));
}

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating...
0
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls...
0
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852...
3
by: TheSteph | last post by:
Hi Experts ! I have a Winform Program in C# / .NET 2.0 I would like to ensure that a value in a TextBox is a valid Int32 when user get out of it (TextBox loose focus)
1
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I've noticed that controls do not raise a Validating event if they are contained in a ToolStripDropDown via a ToolStripControlHost item. Please run the following sample and follow the instructions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.