Allowing entry of a Carriage Return during data entry

M

Mike Owen

Hi,

I am using a ValidationExpression="^[a-zA-Z0-9 '.,]+$" on a
regularexpressionvalidator to restrict what is allowed to be entered in a
MultiLine textbox.

I would also like to allow the user to be able to enter a carriage return,
enabling them to be able to break up the text they enter, but unfortunately
despite all the additional bits that I have tried, e.g. adding \r between the
2 square boxes in the ValidationExpression, nothing seems to work.

How would I change the expression above to allow a CR to be entered? (I
have just thought should I be adding CR & LF not just a CR?).


Thanks, Mike.
 
A

Alessandro Zifiglio

hi Mike, if your looking to break into a newline then just a carriage return
wont suffice. along with \r issue a line feed also, so your expression will
be \n\r for allowing a break into a newline.

ValidationExpression="^[a-zA-Z0-9',.\n\r]+$"

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net
 
M

Mike Owen

Thanks Alessandro.

I was so close yet so far!


Cheers, Mike.

Alessandro Zifiglio said:
hi Mike, if your looking to break into a newline then just a carriage return
wont suffice. along with \r issue a line feed also, so your expression will
be \n\r for allowing a break into a newline.

ValidationExpression="^[a-zA-Z0-9',.\n\r]+$"

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net


Mike Owen said:
Hi,

I am using a ValidationExpression="^[a-zA-Z0-9 '.,]+$" on a
regularexpressionvalidator to restrict what is allowed to be entered in a
MultiLine textbox.

I would also like to allow the user to be able to enter a carriage return,
enabling them to be able to break up the text they enter, but
unfortunately
despite all the additional bits that I have tried, e.g. adding \r between
the
2 square boxes in the ValidationExpression, nothing seems to work.

How would I change the expression above to allow a CR to be entered? (I
have just thought should I be adding CR & LF not just a CR?).


Thanks, Mike.
 
A

Alessandro Zifiglio

your more than welcome, Mike :)

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

Mike Owen said:
Thanks Alessandro.

I was so close yet so far!


Cheers, Mike.

Alessandro Zifiglio said:
hi Mike, if your looking to break into a newline then just a carriage
return
wont suffice. along with \r issue a line feed also, so your expression
will
be \n\r for allowing a break into a newline.

ValidationExpression="^[a-zA-Z0-9',.\n\r]+$"

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net


Mike Owen said:
Hi,

I am using a ValidationExpression="^[a-zA-Z0-9 '.,]+$" on a
regularexpressionvalidator to restrict what is allowed to be entered in
a
MultiLine textbox.

I would also like to allow the user to be able to enter a carriage
return,
enabling them to be able to break up the text they enter, but
unfortunately
despite all the additional bits that I have tried, e.g. adding \r
between
the
2 square boxes in the ValidationExpression, nothing seems to work.

How would I change the expression above to allow a CR to be entered?
(I
have just thought should I be adding CR & LF not just a CR?).


Thanks, Mike.
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top