Validate between 2 textboxes

  • Thread starter Thread starter light of mind. heavy of belly
  • Start date Start date
L

light of mind. heavy of belly

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.
 
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.
 
Hmm, I really wanted to hook this stuff to the validation bits for
consistency's sake.
 
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
 
Wow, that's EXACTLY what I was looking for.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top