Allowing entry of a Carriage Return during data entry

Discussion in 'ASP .Net Web Controls' started by Mike Owen, Jul 27, 2006.

  1. Mike Owen

    Mike Owen Guest

    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.
     
    Mike Owen, Jul 27, 2006
    #1
    1. Advertising

  2. 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" <> ha scritto nel messaggio
    news:...
    > 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.
     
    Alessandro Zifiglio, Jul 27, 2006
    #2
    1. Advertising

  3. Mike Owen

    Mike Owen Guest

    Thanks Alessandro.

    I was so close yet so far!


    Cheers, Mike.

    "Alessandro Zifiglio" wrote:

    > 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" <> ha scritto nel messaggio
    > news:...
    > > 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.

    >
    >
    >
     
    Mike Owen, Jul 27, 2006
    #3
  4. your more than welcome, Mike :)

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

    "Mike Owen" <> ha scritto nel messaggio
    news:...
    > Thanks Alessandro.
    >
    > I was so close yet so far!
    >
    >
    > Cheers, Mike.
    >
    > "Alessandro Zifiglio" wrote:
    >
    >> 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" <> ha scritto nel messaggio
    >> news:...
    >> > 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.

    >>
    >>
    >>
     
    Alessandro Zifiglio, Jul 27, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    3
    Views:
    3,805
  2. ack95
    Replies:
    0
    Views:
    560
    ack95
    Mar 3, 2006
  3. Dustin J. Mitchell

    Redux: Allowing 'return obj' in generators

    Dustin J. Mitchell, Jun 10, 2007, in forum: Python
    Replies:
    0
    Views:
    273
    Dustin J. Mitchell
    Jun 10, 2007
  4. Xeno Campanoli
    Replies:
    0
    Views:
    249
    Xeno Campanoli
    Feb 13, 2006
  5. Steve Anderson
    Replies:
    3
    Views:
    283
    Steve Anderson
    Jun 21, 2004
Loading...

Share This Page