Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
RegExp does not seem to work for text validator
posted

Hi,

Im using regExp validator option for a text editor [igTextEditor], but is does not seem to work correctly.

If I use "^[0-9]+$" for only numbers, it allows everything.

Can you please suggest what is the regExp to be used ?

Also, I need a regExp to validate that the field should not contain only spaces.

Thanks,

Sushma

Parents
No Data
Reply
  • 10685
    Verified Answer
    Offline posted

    Hello Sushma, 

    It is possible to use regExp for igTextEditor input validation.

    What is required is to specify the validatorOptions and include the expression as well. For example, initializing igTextEditor with validatorOptions will look like the following: 

                $("#textEditor").igTextEditor({      
                    validatorOptions:{
                    required : true,
                    keepFocus: "once",
                    regExp : "^[0-9]+$",
                    width: 195
                  }
             });

     

    You could observe a sample with this regExp and the expected behavior here

    As various igEditors depend on the igValidator widget, you could find it’s API here:
    http://help.infragistics.com/jQuery/2015.1/ui.igvalidator#options:regExp 

    What is more, there are a couple of online samples regarding validation to be found at our IgniteUI site.
    For example: http://igniteui.com/editors/validation . In this sample, during the initialization a function is set for validationOptions: getValidationOptions(). This shows the flexibility to provide these options on later stage, depending on some specific conditions. 

    In case you are using a different version of IgniteUI where the regExp validation is not working as expected, please let me know so we could take the necessary steps.

Children