mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: update select validation for boolean attributes
This commit is contained in:
1 parent
420e012a43
commit
8d855e53e3
1 file changed
+16
-3
@@ -27,15 +27,28 @@
|
||||
error = element.validationMessage;
|
||||
};
|
||||
|
||||
$: if (element && required && !value) {
|
||||
const isValid = (value: string | number | boolean) => {
|
||||
if (typeof value === 'boolean') {
|
||||
if (value === null || value === undefined) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
$: if (element && required && !isValid(value)) {
|
||||
element.setCustomValidity('This field is required');
|
||||
}
|
||||
|
||||
$: if (element && required && value) {
|
||||
$: if (element && required && isValid(value)) {
|
||||
element.setCustomValidity('');
|
||||
}
|
||||
|
||||
$: if (value) {
|
||||
$: if (isValid(value)) {
|
||||
error = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user