We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

validation message appears even after value change using ejDropDownList

Hello Syncfusion Support , 

I Have this dropdown list which displays gender for the user to select one , if the user didn't select gender and submit the form required filed message should appear .

but this error message appears inside the dropdown . and if I select a gender this this message does not disappear . So , 

 how I can hide this error message after i select a gender ?

and how to make this error message appears outside the dropdown list . (under the dropdown)?

Thanks in advanced.

 $('#Gender').ejDropDownList({
            dataSource: self.Gender,
            fields: { text: "name", value: "id" },
            select: function (args) {
                console.log("Value is " + args.value);
                self.GenderId(args.value);
            },
            validationRules: {
                required: true
            },
            validationMessage: {
                required: "Required field"
            },
            watermarkText: "Gender",
            width: "100%"
        });

1 Reply

AB Ashokkumar Balasubramanian Syncfusion Team August 29, 2019 06:57 AM UTC

Hi Ali Ossaily, 
 
Good day to you. 
 
For this scenario, you can bind the change event and validate the corresponding Dropdown List in your application. Please refer the below code block. 
 
      $('#name').ejDropDownList({ 
            dataSource: items, 
            fields: { 
                text: "name", 
                value: "id" 
            } 
            , 
            watermarkText: "Gender", 
            validationRules: { 
                required: true 
            }, 
            validationMessage: { 
                required: "Required field" 
            }, 
            change: "ddlValid" 
        }); 
           function ddlValid() { 
                 this.element.valid(); 
           } 
 
 
To know more details about Dropdown List validation, please refer the below help document. 
 
 
Could you please check the provided information’s and get back to us, if you require any further assistance on this? 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon