473,783 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validate between 2 textboxes

Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that empty
textboxes are not evaluated?

Thanks for your ideas.
Jun 3 '06 #1
5 1239
I'm not sure of any way you can use the validator controls in this
scenarios. It would be much easier to write a small Javascript that
check the values of those controls.

a single IF statement would actually do the trick.

light of mind. heavy of belly wrote:
Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that empty
textboxes are not evaluated?

Thanks for your ideas.


Jun 3 '06 #2
Hmm, I really wanted to hook this stuff to the validation bits for
consistency's sake.

<ta****@gmail.c om> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
I'm not sure of any way you can use the validator controls in this
scenarios. It would be much easier to write a small Javascript that
check the values of those controls.

a single IF statement would actually do the trick.

light of mind. heavy of belly wrote:
Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that
empty
textboxes are not evaluated?

Thanks for your ideas.

Jun 3 '06 #3
A CustomValidator would give you what you need on both the server and
client sides. Check out this example:
http://www.codeproject.com/aspnet/Mu...dValidator.asp

Curtis

light of mind. heavy of belly wrote:
Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that empty
textboxes are not evaluated?

Thanks for your ideas.


Jun 3 '06 #4
OK, so how would I go about doing that exactly?

Heres my first attempt at calling some client script:

protected void Page_Load(objec t sender, EventArgs e)

{

string script = @"

<script language=JavaSc ript>

function doEmailOrPhoneC heck(){

alert('here');

return false;

}

</script>";

RegisterClientS criptBlock("onS ubmitCheck", script);

SubmitButton.At tributes.Add("o nsubmit", "onSubmitCheck" );

}

What am I doing wrong?

Thanks
"light of mind. heavy of belly" <***@***.com> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hmm, I really wanted to hook this stuff to the validation bits for
consistency's sake.

<ta****@gmail.c om> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
I'm not sure of any way you can use the validator controls in this
scenarios. It would be much easier to write a small Javascript that
check the values of those controls.

a single IF statement would actually do the trick.

light of mind. heavy of belly wrote:
Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that
empty
textboxes are not evaluated?

Thanks for your ideas.


Jun 3 '06 #5
Wow, that's EXACTLY what I was looking for.

Cheers
"Curtis" <cu**********@h otmail.com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
A CustomValidator would give you what you need on both the server and
client sides. Check out this example:
http://www.codeproject.com/aspnet/Mu...dValidator.asp

Curtis

light of mind. heavy of belly wrote:
Hi,

I need to validate that at one of 2 textboxes has some data in it. Is it
possible to hook the validation system to do this bearing in mind that
empty
textboxes are not evaluated?

Thanks for your ideas.

Jun 3 '06 #6

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

Similar topics

1
1976
by: Johnny | last post by:
Hello, I've read somewhere that you can validate form data before actually submitting it, similar to what validation controls would do. For example, I have a form that has 2 textboxes. I populate the 2 textboxes with values from the database. I also have an update button that will update the values. If I have not made any change to the data in the textboxes, then I do not want to submit the data when the update button is clicked. I...
0
1260
by: Drew | last post by:
Hey, i am currently looking for a nice solution for the following problem ( i could not find a sufficient solution in the other postings ): I am having several textboxes on my page, some of them have RequieredFieldValidators some not and i am having a ValidationSummary at the top of my page to list all blank textboxes. Everything is working fine so far... but now i have two other textboxes. At least one of these two textboxes
2
1007
by: JIM.H. | last post by:
Hello, can I add only one regular expression component and validate many textboxes? Thanks, Jim.
3
1704
by: JJ_377 | last post by:
how do I do this: textbox is in a panel control. the required field validator doesn't work. I tried putting the required field validator inside the panel and it doesn't work there either. my validators are working for controls OUTSIDE the panels.. help please? And, thank you. J.
7
1383
by: Rich | last post by:
Hello, I have 10 textboxes on a form. I would like to validate text-data entry on each textbox. I was looking for a Form_Current event or Form_Change event but did not recognize any such events. Or maybe there is a property for the Textboxes where I can set data entry conditions? Wondering about CausesValidation textbox property-how to use.
0
981
by: Marina | last post by:
Let's say a user control has a bunch of textboxes. At some point the user control calls Validate to make sure all input is processed. The Validating event is fired, and if the input was invalid, e.Cancel is set to True. In this case Validate returns True or False correctly, based on whether the input was acceptable. But, if Validate is called from the parent form (or a user control that contains this user control), then the result is...
4
2597
by: Brybot | last post by:
I have a form that i've split up into multiple asp:panels, each panel has a number of validators which work correctly. At on the last panel, i want to commit the data collected to a database. I figured since all the panel data is still being sent through the postbacks, instead of using Sessions, or HttpContext, I could just take the values from the textboxes. This all works fine, except for security. I realized that I could inject...
5
1873
by: Ganesh | last post by:
Hi There, I need to validate email address with regular expression control, i tried something like this ^+*@*\.*$ but i need to validate even if it is blank, it should say invalid email, but don't want to use another requirefield validator
1
6340
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using the following "DateTextBox" class module). Whenever a user enters in to the textbox, the code displays "Please enter date in mm/dd/yyyy format (for ex: 01/01/2009)." message which is accomplished using "MouseUp" event. And, I used "Exit" event to...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.