You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api-reference/10 UI Components/dxForm/5 Item Types/SimpleItem/isRequired.md
+17-16Lines changed: 17 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,28 +5,29 @@ default: undefined
5
5
---
6
6
---
7
7
##### shortDescription
8
-
Specifies whether the current form item is required.
8
+
Specifies if the current form item is required.
9
9
10
10
---
11
+
When this property is enabled, Form uses [RequiredRule](/api-reference/10%20UI%20Components/dxValidator/8%20Validation%20Rules/RequiredRule'/Documentation/ApiReference/UI_Components/dxValidator/Validation_Rules/RequiredRule/') to validate the current item. The following values break **RequiredRule**:
12
+
13
+
-[Falsy JavaScript values](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) except `0`, `-0`, `0n`, and `NaN`.
14
+
- Invalid values for the target editor (for example, a non-numeric string for the [NumberBox](/api-reference/10%20UI%20Components/dxNumberBox'/Documentation/ApiReference/UI_Components/dxNumberBox/') component).
15
+
11
16
[note]
12
17
13
-
If you specify validation rules using the [validationRules](/api-reference/10%20UI%20Components/dxForm/5%20Item%20Types/SimpleItem/validationRules.md'/Documentation/ApiReference/UI_Components/dxForm/Item_Types/SimpleItem/#validationRules') property, the **isRequired** property is ignored. In this case, use the [Require](/api-reference/10%20UI%20Components/dxValidator/8%20Validation%20Rules/RequiredRule'/Documentation/ApiReference/UI_Components/dxValidator/Validation_Rules/RequiredRule/')validation rule instead.
18
+
If you specify [validationRules](/api-reference/10%20UI%20Components/dxForm/5%20Item%20Types/SimpleItem/validationRules.md'/Documentation/ApiReference/UI_Components/dxForm/Item_Types/SimpleItem/#validationRules'), Form ignores the **isRequired** property. To implement **isRequired** functionality, specify a **RequiredRule**validation rule:
14
19
15
20
---
16
21
##### jQuery
17
22
18
23
<!--JavaScript-->
19
24
$(function() {
20
-
$("#formContainer").dxForm({
21
-
// ...
25
+
$('#formContainer').dxForm({
22
26
items: [{
23
-
// ...
24
27
validationRules: [
25
-
{ type: "required" }
28
+
{ type: 'required' }
26
29
]
27
-
},
28
-
// ...
29
-
]
30
+
}, ... ]
30
31
});
31
32
});
32
33
@@ -40,7 +41,7 @@ If you specify validation rules using the [validationRules](/api-reference/10%20
40
41
</dx-form>
41
42
42
43
<!--TypeScript-->
43
-
import { DxFormModule } from "devextreme-angular";
44
+
import { DxFormModule } from 'devextreme-angular/ui/form';
44
45
// ...
45
46
export class AppComponent {
46
47
// ...
@@ -57,14 +58,14 @@ If you specify validation rules using the [validationRules](/api-reference/10%20
57
58
58
59
<!-- tab: App.vue -->
59
60
<template>
60
-
<DxForm ...>
61
-
<DxSimpleItem ...>
62
-
<DxRequiredRule .../>
61
+
<DxForm ...>
62
+
<DxSimpleItem ...>
63
+
<DxRequiredRule .../>
63
64
</DxSimpleItem>
64
65
</DxForm>
65
66
</template>
66
67
<script>
67
-
import DxForm, { DxSimpleItem, DxRequiredRule } from 'devextreme-vue/form';
68
+
import { DxForm, DxSimpleItem, DxRequiredRule } from 'devextreme-vue/form';
68
69
69
70
export default {
70
71
components: {
@@ -79,9 +80,9 @@ If you specify validation rules using the [validationRules](/api-reference/10%20
79
80
80
81
<!-- tab: App.js -->
81
82
import React from 'react';
82
-
import Form, { SimpleItem, RequiredRule } from 'devextreme-react/form';
83
+
import { Form, SimpleItem, RequiredRule } from 'devextreme-react/form';
Copy file name to clipboardExpand all lines: api-reference/10 UI Components/dxValidator/8 Validation Rules/RequiredRule/RequiredRule.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,13 @@ generateTypeLink:
7
7
---
8
8
---
9
9
##### shortDescription
10
-
A validation rule that demands that a validated field has a value.
10
+
A validation rule that rejects empty and invalid values.
11
11
12
12
---
13
-
Use this rule type to ensure the target editor value is specified. The rule will be broken in the following cases.
13
+
The following values break **RequiredRule**:
14
14
15
-
-If the validated value is **null**, **false**, or **undefined**.
16
-
-If the specified value has a type that is not expected for the target field (e.g., a string for the [DateBox](/api-reference/10%20UI%20Components/dxDateBox'/Documentation/ApiReference/UI_Components/dxDateBox/') UI component).
15
+
-[Falsy JavaScript values](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) except `0`, `-0`, `0n`, and `NaN`.
16
+
-Invalid values for the target editor (for example, a non-numeric string for the [NumberBox](/api-reference/10%20UI%20Components/dxNumberBox'/Documentation/ApiReference/UI_Components/dxNumberBox/') component).
0 commit comments