Form
Extends:
react~Component → Form
Controls the form element and validates all children when trying to submit
Example:
<Form action='http://someaction.example.com/'>
<ImageField id='avatar' name='avatar' label='Avatar' />
<Field id='username' name='username'
label='Username' placeholder='Enter your username'
suggestion='Only accepts letters and numbers'
patternError='Input format is wrong, only accepts letters and numbers'
required pattern='^[a-zA-Z0-9]+$' />
<Field id='name' name='name'
label='Name' placeholder='Enter your full name' />
<EmailField id='email' name='email'
label='Email' placeholder='Enter your email address' />
<DropdownField id='sex' name='sex' label='Sex' placeholder='Select one' required>
<option value='M'>Male</option>
<option value='F'>Female</option>
</DropdownField>
<TextareaField id='comments' name='comments' label='Comments'
suggestion='This field has a 100 character limit'
maxChars={100} maxCharsError='Character limit reached' />
</Form>
Method Summary
Public Methods | ||
public |
onCancel() |
Static Public Members
public static propTypes: Object source
Properties:
Name | Type | Attribute | Description |
children | Array<HTMLOptionElement> | Elements to show inside the form |
|
action | String | The form action attribute |
|
onSubmit | Function | Triggers when the user submits a valid form |
|
onCancel | Function |
|
Triggers when the user clicks the cancel button |
method | String |
|
The method to use when submitting the form |