validate email and checks blank as well

G

Ganesh

Hi There,

I need to validate email address with regular expression control, i tried
something like this

^+[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$

but i need to validate even if it is blank, it should say invalid email, but
don't want to use another requirefield validator

Thanks
Ganesh
 
M

Mike

then use javascript. but why do that since you can use the required field
validator? Just drag and drop it to your page, pick your email textbox to
validate and your done.

Hell its there and it saves time, use, I don't see or understand why you
wouldn't in a case like this.
 
G

Ganesh

Thanks for your email

I've other controls which i use requirevalidator in the same column, my
email if i use both require and regulrexpression it will be aligned in just
further right. I thought if i can use expression itself it would be good.

i'm not expect in regular expression, i think there must be a way to
validate

Thanks
Ganesh

Mike said:
then use javascript. but why do that since you can use the required field
validator? Just drag and drop it to your page, pick your email textbox to
validate and your done.

Hell its there and it saves time, use, I don't see or understand why you
wouldn't in a case like this.


Ganesh said:
Hi There,

I need to validate email address with regular expression control, i tried
something like this

^+[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$

but i need to validate even if it is blank, it should say invalid email,
but don't want to use another requirefield validator

Thanks
Ganesh
 
M

Mike

you can still user a required field validator, just format the HTML so they
appear as you want.
I don't see any sense in making extra work for something that can be done in
like 30 seconds - if that

right now I have a form with 4 textboxes and are all required and 2 i'm
using expression.
I have all the controls formattted via HTML so they show on the page nice
and neat.

Ganesh said:
Thanks for your email

I've other controls which i use requirevalidator in the same column, my
email if i use both require and regulrexpression it will be aligned in
just further right. I thought if i can use expression itself it would be
good.

i'm not expect in regular expression, i think there must be a way to
validate

Thanks
Ganesh

Mike said:
then use javascript. but why do that since you can use the required field
validator? Just drag and drop it to your page, pick your email textbox to
validate and your done.

Hell its there and it saves time, use, I don't see or understand why you
wouldn't in a case like this.


Ganesh said:
Hi There,

I need to validate email address with regular expression control, i
tried something like this

^+[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$

but i need to validate even if it is blank, it should say invalid email,
but don't want to use another requirefield validator

Thanks
Ganesh
 
G

Ganesh

Thanks, I'll follow the way if there is no way.

Still i'd prefer if anyone have answer for my question, one is my learning
purpose just want to know how to do this. Next thing defintly in future i'm
going to have more regular expression don't want to use both(require and
regular expression)

Thanks

Mike said:
you can still user a required field validator, just format the HTML so
they appear as you want.
I don't see any sense in making extra work for something that can be done
in like 30 seconds - if that

right now I have a form with 4 textboxes and are all required and 2 i'm
using expression.
I have all the controls formattted via HTML so they show on the page nice
and neat.

Ganesh said:
Thanks for your email

I've other controls which i use requirevalidator in the same column, my
email if i use both require and regulrexpression it will be aligned in
just further right. I thought if i can use expression itself it would be
good.

i'm not expect in regular expression, i think there must be a way to
validate

Thanks
Ganesh

Mike said:
then use javascript. but why do that since you can use the required
field validator? Just drag and drop it to your page, pick your email
textbox to validate and your done.

Hell its there and it saves time, use, I don't see or understand why you
wouldn't in a case like this.


Hi There,

I need to validate email address with regular expression control, i
tried something like this

^+[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$

but i need to validate even if it is blank, it should say invalid
email, but don't want to use another requirefield validator

Thanks
Ganesh
 
G

Guest

Thanks, I'll follow the way if there is no way.

Still i'd prefer if anyone have answer for my question, one is my learning
purpose just want to know how to do this. Next thing defintly in future i'm
going to have more regular expression don't want to use both(require and
regular expression)

It's not possible by design, because RegularExpressionValidator
succeeds validation if the input control is blank. And if a value is
required, you should use a RequiredFieldValidator in addition to the
RegularExpressionValidator control.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top