Validators disable ! RRS feed

  • Question

  • User-42311961 posted
    Hey all,

    I have a serious problem. When i change the language of my ressource manager. My defaut assembly file is language.resx and it containt french traduction. When I change for use my language.en.resx file, all my Validators are disable and my form isn't protected !!

    After one day of research I haven't found the source of this problem... Does someone can help me ?

    Instruction for change my assembly langugae culture :
     Thread.CurrentThread.CurrentUICulture = New CultureInfo("en")
    Thursday, May 12, 2005 9:53 AM

All replies

  • User1806792307 posted

    It sounds like the WebUIValidation.js file isn't loading. View the HTML source to confirm its <script> tag is present and attempt to open the file from the browser using its URL and the web site's domain.

    You also *must* test Page.IsValid is true before saving in the Click event method. Otherwise, all browsers without client-side validation support will bypass your validation. This includes Mozilla, FireFox, Safari, and even IE with javascript disabled.

    Friday, May 13, 2005 10:53 AM
  • User-42311961 posted

    Firstly, thanks for you answer.

    My page is a Mobile Web form, so there are not javascript client side validators. My problem is that all my server side validators aren't executed ( request field validator are allways true, and the custom validator method isn't called). So when I test Page.Isvalid in my Bouton method, this value is allways true...

    Monday, May 16, 2005 3:48 AM
  • User1806792307 posted

    Confirm that your submit button's CausesValidation property is true. When its false, it does not automatically call Page.Validate(), which runs validation.

    Confirm that your validators are Enabled=true

    If you are using ASP.NET 2.0, confirm that the validation group on the submit button matches the group on each validator.

    Monday, May 16, 2005 11:51 AM
  • User-42311961 posted

    I don't find the enabled parameter of my validators but all of them are visible. If in my OnClick method of my button I call the Page.Validate() method, this one do nothing and my Page.Validate parametter is allways True.

    The validators are executed with some phone users agent, and not for some others...

    PS: I'm using ASP.Net 1.1

    Monday, May 23, 2005 3:55 AM
  • User1806792307 posted

    I don't have a definitive answer. I understand how ASP.NET works here so I'll review the facts with you in case it reveals something to you.

    Page.Validate() goes through the Page.Validators list. If the validator control is Enabled, the method Validate() is called on it. That internally sets the IsValid property on the Validator control to either true or false. If any control is found to be IsValid=false, Page.IsValid is set to false.

    The validator's Validate() method calls an internal "evaluation method" where all the logic is. For example, the RequiredFieldValidator will retrieve the text value from the ControlToValidate property and compare it to the InitialValue property. If the text value is not equal to InitialValue, it returns an indication that its valid.

    Some things can go wrong but they are usually server side problems. For example, you set EnableViewState=false and only set ControlToValidate the first time. On post back, ControlToValidate is "". Another case is that the data isn't being passed back. So the TextBox.Text property does not have the data you think. (This is the only thing that I can connect to a specific platform.) My recommendation is to write some debug code in the Click post back event that confirms all of the properties used to evaluate (ControlToValidate, ValueToCompare, Operator, Type, etc.). Debug the value of the textbox to confirm is right. Then call Validate() on the validator itself and test the validator's IsValid property.

    Monday, May 23, 2005 12:50 PM
  • User-42311961 posted
    Tahnks you for you answer,

    I have found my error, that was the wap navigator that doesn't return the button value of the form and I used it to switch visible my panel. Now, I set my visible parametter directly in my click method and that's good :).

    Wednesday, May 25, 2005 9:42 AM