Angular Form - Additional Marks
Simple items may require a value or may allow a user to skip it. Both types of items can be marked with a symbol or text. Required items are those whose isRequired property is true, others are considered optional.
To specify the mark or text for required and optional items, use the requiredMark and optionalMark properties. Note that the "optional" mark will not be displayed until you set the showOptionalMark property to true. You can also hide the "required" mark using the showRequiredMark property.
- <dx-form
- [(formData)]="employee"
- requiredMark="!"
- optionalMark="opt"
- [showOptionalMark]="true">
- <dxi-item dataField="firstName" [isRequired]="true"></dxi-item>
- <dxi-item dataField="lastName" [isRequired]="true"></dxi-item>
- <dxi-item dataField="position"></dxi-item>
- </dx-form>
- import { DxFormModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- employee = {
- firstName: "John",
- lastName: "Heart",
- position: "CEO"
- }
- }
- @NgModule({
- imports: [
- // ...
- DxFormModule
- ],
- // ...
- })
Each label ends with a colon. To hide it, assign false to the showColonAfterLabel property. Note that you can show/hide a colon for an individual item using the label.showColon property.
- <dx-form
- [(formData)]="employee"
- [showColonAfterLabel]="false">
- <dxi-item dataField="firstName"></dxi-item>
- <dxi-item dataField="lastName"></dxi-item>
- <dxi-item dataField="position">
- <dxo-label [showColon]="true"></dxo-label>
- </dxi-item>
- </dx-form>
- import { DxFormModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- employee = {
- firstName: "John",
- lastName: "Heart",
- position: "CEO"
- }
- }
- @NgModule({
- imports: [
- // ...
- DxFormModule
- ],
- // ...
- })
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.