|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Required field validatorHi
If a textbox is being validated using a required field validator then we need to key in some text before sumbmitting the form. But if we key in a space character this gets validated to true and the form gets submitted. I want to make sure that the user enters some text and submit the form, and not just enter a space character and submitting the form. Any ideas how to achieve this. Thanks, Srinivas Srivivas, you will most likely have to use a RegularExpressionValidator
or CustomValidator to get the results you want. Jason Bentley http://geekswithblogs.net/jbentley You are saying that a single space character allows a RequiredFieldValidator
to accept the text? That is incorrect. The RequiredFieldValidator and all other validators strip off lead and trailing spaces before evaluating text. A single space would be eliminated and the field would be considered blank. So if a single space is causing it to be accepted, something else is wrong. Consider these issues: 1. Client-side validation isn't running or the submit button has causesValidation=false. That means the page will submit without checking the textbox. 2. On the server side, the submit button's OnClick method automatically validates before calling your Click event. It will not do this when CausesValidation is false. Users also forget to check for Page.IsValid in the Click event method before saving data. --- Peter Blum www.PeterBlum.com Email: PLB***@PeterBlum.com Creator of "Professional Validation And More" at http://www.peterblum.com/vam/home.aspx Show quoteHide quote "Srinivas" <no.spam@email.com> wrote in message news:ulYwBKfLFHA.1884@TK2MSFTNGP15.phx.gbl... > Hi > > If a textbox is being validated using a required field validator then we > need to key in some text before sumbmitting the form. But if we key in a > space character this gets validated to true and the form gets submitted. I > want to make sure that the user enters some text and submit the form, and > not just enter a space character and submitting the form. Any ideas how to > achieve this. > > Thanks, > > Srinivas > > This is not the default behavior -- whitespace is trimmed prior to validation.
Can you post your ASPX? -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Hi > > If a textbox is being validated using a required field validator then > we need to key in some text before sumbmitting the form. But if we key > in a space character this gets validated to true and the form gets > submitted. I want to make sure that the user enters some text and > submit the form, and not just enter a space character and submitting > the form. Any ideas how to achieve this. > > Thanks, > > Srinivas >
IndexOutOfBounds on databinding
Know page that fired an event Open web page in WORD File Delete: Path is to long add from a drop down list UnauthorizedAccessException upon access to an ASP>NET web service Specified cast is not valid IIS / ASP.NET freezing computer CSS problem redirecty on unauthorized page? |
|||||||||||||||||||||||