RequiredFieldValidator on MultiLine TextBox 
Author Message
 RequiredFieldValidator on MultiLine TextBox

I'm placing a
    <asp:TextBox ID="TextBox1" TextMode="MultiLine" ...>
along with a corresponding
    <asp:RequiredFieldValidator ControlToValidate="TextBox1" ...>
on an aspx page.

The problem:
Validation works if I:
    Leave Field Blank;
    Type in field without using <Enter> key (no manual line breaks);
    Type in field, Hit <Enter> key and don't type anything else

Validation fails if I:
    Type in field, Hit <Enter> key and continue typing (manual line breaks)

Has anyone else found this? Am I leaving out a parameter in the Validator to
deal with multi?



Mon, 22 Mar 2004 01:48:59 GMT  
 RequiredFieldValidator on MultiLine TextBox
I was able to figure this out:
Inside WebUIValidation.js, change the ValidatorTrim() function to search
multiple line regularexpression.

This is the current function:
function ValidatorTrim(s) {
    var m = s.match(/^\s*(.*\S)\s*$/);
    return (m == null) ? "" : m[1];

Quote:
}

Change to:
function ValidatorTrim(s) {
    var m = s.match(/^\s*(.*\S)\s*$/m);    // Note the "m" added to the end
of the expression
    return (m == null) ? "" : m[1];

Quote:
}



Quote:
> I'm placing a
>     <asp:TextBox ID="TextBox1" TextMode="MultiLine" ...>
> along with a corresponding
>     <asp:RequiredFieldValidator ControlToValidate="TextBox1" ...>
> on an aspx page.

> The problem:
> Validation works if I:
>     Leave Field Blank;
>     Type in field without using <Enter> key (no manual line breaks);
>     Type in field, Hit <Enter> key and don't type anything else

> Validation fails if I:
>     Type in field, Hit <Enter> key and continue typing (manual line
breaks)

> Has anyone else found this? Am I leaving out a parameter in the Validator
to
> deal with multi?



Mon, 22 Mar 2004 03:17:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. multiline text in TextBox

2. multiline text in TextBox

3. VB ActiveX Textbox with Multiline and ATL Container

4. Multiline in a textBox

5. How to control whitespace length for Tab in Multiline textbox

6. Problem with multiline textbox

7. Invalidate a RequiredFieldValidator

8. Difficulties in unsing RequiredFieldValidator

9. Changing textbox.text for bound textbox doesn't update database

10. checking if textbox.text is integer value (or only allow integers in textbox)

11. Web form textbox Vs Windows form textbox.....

12. How to add a line to a Multiline TextBox ?

 

 
Powered by phpBB® Forum Software