Hi DeBao Chua,
Thank you for contacting Syncfusion support.
Here are details about the components DropdownList, TextField and DatePicker for your queries,
|
Components |
Reply for Multiple class names in CssClass & Validation using FormValidator |
|
DropDownList |
Multiple CssClass supported. Here is the sample with FormValidator,
|
|
TextBox |
From the release version 16.3.25 onwards cssClass property accepts the multiple classes. Sample prepared along with Validation,
|
|
DatePicker |
Multiple CssClass supported. Here is the sample with FormValidator,
|
Regarding the documentation you have asked, We have logged this as a documentation improvement for Form Validation using React controls. This will be included in any of our upcoming releases. We have created a form validation sample in React,
step1:
Need to import Form Validator control
|
import { FormValidator, FormValidatorModel } from'@syncfusion/ej2-inputs' |
step2:
Need to import button control
|
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
|
step3:
Then initialize button component and form validator in componentDidMount()
componentDidMount() {
// Initialize the Submit Button.
var buttonFormValidate = new ButtonComponent({
isPrimary: true
});
buttonFormValidate.appendTo('#validateSubmit');
var buttonReset = new ButtonComponent({});
buttonReset.appendTo('#resetbtn');
// Initialize the FormValidator.
var formObj = new FormValidator('#formId', options);
document.getElementById('formId').addEventListener("submit", function (e) {
e.preventDefault();
if (formObj.validate()) {
alert('Customer details added!');
formObj.reset();
}
});
}
step 4:
Add validation rules:
var options = {
rules: {
User: { required: true },
Email: { email: [true, 'Enter valid Email'] },
DOB: { date: [true, 'Enter valid format'] },
City: { required: true }
}
};
};
Step 5:
Then create HTML content inside the render() method.
render() {
return (
<div class="col-lg-12 control-section">
<input type="text" id="mail" name="Email" required data-msg-containerid="mError" />
</div>);
}
}
Please let us know if you need any further assistance.
Thanks,
Christo