React/Redux newbie here.
I have implemented a management portal using Admin On Rest. In a Create component I have a Tabbed Form with TextInput components for various form fields. Included in those are firstName, lastName and userName. I need to compose the username from the first 4 characters of the firstName and the lastName as the user enters the name. In order to access the field values for firstName and lastName I have tried to decorate the Create component with a redux-form, but to no avail. I clearly don't understand how redux-form works. How can I accomplish the above within Admin On Rest? Here's one of my Create components:
export const HPCreate = (props, state) => (
<Create {...props}>
<TabbedForm validate={validateUserCreation}>
<FormTab label="Personal Details">
<TextInput source="userName" validate={[required, noSpace]} options={opts} autoComplete='off'/>
<TextInput validate={[required]} source="password" autoComplete='off' options={opts}/>
<TextInput label="First Name" validate={[required]} source="firstName" options={opts}/>
<TextInput label="Last Name" validate={[required]} source="lastName" options={opts}/>
<TextInput source="phone" validate={[required]} options={opts}/>
<TextInput source="email" validate={[required, email]} options={opts}/>
<TextInput source="address" options={opts}/>
<TextInput source="city" options={opts}/>
<TextInput source="state" options={opts}/>
<TextInput source="zip" validate={[required]} options={opts}/>
</FormTab>
<FormTab label="Account Details">
<ReferenceInput label="Job Title" source="jobTitle" reference="jobtitles" allowEmpty={true}
validation={{required: false}}>
<AutocompleteInput optionText="name" optionValue="name" options={autocompleteOptions}/>
</ReferenceInput>
<ReferenceInput label="Designation" source="designation" reference="designations" allowEmpty={true}
validation={{required: false}}>
<AutocompleteInput optionText="name" optionValue="name" options={autocompleteOptions}/>
</ReferenceInput>
<TextInput label="Employee ID" source="employeeId" options={opts}/>
<ReferenceInput label="Practice Type" source="practiceType" reference="practicetypes" allowEmpty={true}
validation={{required: false}}>
<AutocompleteInput optionText="name" optionValue="name" options={autocompleteOptions}/>
</ReferenceInput>
<ReferenceInput label="Primary Network *" source="primaryNetwork" reference="facilities"
allowEmpty={true} validate={[required]}>
<AutocompleteInput optionText="name" optionValue="name" options={autocompleteOptions} validate={[required]}/>
</ReferenceInput>
<ReferenceArrayInput label="Secondary Networks" source="secondaryNetwork" reference="facilities"
allowEmpty={true}>
<SelectArrayInput optionText="name" optionValue="name" options={opts}/>
</ReferenceArrayInput>
<SelectInput label="User Type" source="userType"
choices={[
{id: 'PATIENT', name: 'PATIENT'},
{id: 'PHYSICIAN', name: 'PHYSICIAN'},
{id: 'STAFF', name: 'STAFF'},
{id: 'FRONT DESK ADMIN', name: 'FRONT DESK ADMIN'},
{id: 'HOSPITAL ADMIN', name: 'HOSPITAL ADMIN'},
{id: 'HOSPITAL SUPERADMIN', name: 'HOSPITAL SUPERADMIN'},
{id: 'SALES TEAM', name: 'SALES TEAM'}
]}
options={opts}
validate={[required]}
/>
<DependentInput dependsOn="neverExpire" value={false}>
<DateInput source="expirationDate" options={opts}/>
</DependentInput>
<BooleanInput label="Never expire?" source="neverExpire" defaultValue={true}/>
</FormTab>
</TabbedForm>
</Create>