Skip to content

Commit c7bd209

Browse files
committed
Pass name prop of FormInput/Select/TextArea to their input element
1 parent 239f249 commit c7bd209

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.13 (07/04/2021)
2+
3+
- The `name` prop on FormTextArea and FormSelect did not get passed to their input element.
4+
15
# 1.2.12 (05/04/2021)
26

37
- Excluding \*.modern.js files from build.

Todo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
- Nested validators in child forms to improve validation performance
55
- Combine array helpers into one object? This is usefull to pass to other components
66
- Require index for array fields
7+
- Add React.forwardRef to input elements

src/elements/FormInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export function FormInput<
198198
}
199199
}
200200
}}
201-
name={name as string}
201+
name={name + ""}
202202
{...rest}
203203
/>
204204
);

src/elements/FormSelect.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function FormSelect<T, State extends DefaultState = DefaultState, Error e
3939
if (hideWhenNull && (value === null || value === undefined)) return null;
4040
return (
4141
<select
42+
name={name + ""}
4243
style={{
4344
...style,
4445
...(dirty && dirtyStyle),

src/elements/FormTextArea.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function FormTextArea<T, State extends DefaultState = DefaultState, Error
3939
if (hideWhenNull && (value === null || value === undefined)) return null;
4040
return (
4141
<textarea
42+
name={name + ""}
4243
style={{
4344
...style,
4445
...(dirty && dirtyStyle),

0 commit comments

Comments
 (0)