473,378 Members | 1,498 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,378 software developers and data experts.

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 1226
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.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.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(object sender, EventArgs e)

{

string script = @"

<script language=JavaScript>

function doEmailOrPhoneCheck(){

alert('here');

return false;

}

</script>";

RegisterClientScriptBlock("onSubmitCheck", script);

SubmitButton.Attributes.Add("onsubmit", "onSubmitCheck");

}

What am I doing wrong?

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

<ta****@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.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**********@hotmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.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
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...
0
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...
2
by: JIM.H. | last post by:
Hello, can I add only one regular expression component and validate many textboxes? Thanks, Jim.
3
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...
7
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...
0
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,...
4
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...
5
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,...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.