kor TürkçeGitHub

Form

Groups fields into sections and checks required values.

kor/ui/FormSource

When to use

  • Give related fields a section heading and validate before saving.

Examples

Validate a required field

Loading the example

<k:Stack gap="12">
	<k:Form id="form">
		<k:FormSection title="Contact">
			<k:TextField label="Name" required="true"/>
		</k:FormSection>
	</k:Form>
	<k:Button kind="primary" text="Save contact" press=".onSave"/>
</k:Stack>

Edit dispatch details

Loading the example

<k:Stack gap="12">
	<k:Form id="form">
		<k:FormSection title="Shipment" text="These details appear on the dispatch list." columns="2">
			<k:TextField label="Reference" value="SH-104" required="true"/>
			<k:DateField label="Dispatch date" required="true"/>
		</k:FormSection>
		<k:FormSection title="Handling">
			<k:Check text="Handle with care"/>
		</k:FormSection>
	</k:Form>
	<k:Button kind="primary" text="Save shipment" press=".onSave"/>
</k:Stack>

API

Properties

NameTypeDefaultDescription
stackedbooleanfalseWhether section titles sit above the fields

Aggregations

NameTypeDescription
sectionsFormSection[]Form sections

Methods

NameDescription
getFields(): Control[]Returns the fields in the form
validate(): booleanMarks empty required fields, focuses the first invalid field and returns whether every required field is filled

FormSection

A labeled group of fields in a form.

Properties

NameTypeDefaultDescription
titlestringSection title
textstringSection description
columnsint2Number of field columns

Aggregations

NameTypeDescription
contentsap.ui.core.Control[]Fields and other controls in the section

Related

TextFieldDateFieldFileDrop