redux-form#reduxForm JavaScript Examples
The following examples show how to use
redux-form#reduxForm.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceActivityType.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
ResourceActivityType = reduxForm({
form: 'activityTypeForm',
enableReinitialize: true,
onSubmit: async (values, dispatch, props) => {
try {
props.onChangeActivityType();
const data = values.activityType;
props.showSelectActivity(data);
} catch (e) {
// console.log(e.message);
}
},
onChange: (values, dispatch, props) => {
// props.onChangeActivityType(values.activityType);
const data = values.activityType;
props.showSelectActivity(data);
// props.submit();
},
})(ResourceActivityType);
Example #2
Source File: ResourceSelectActivity.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
ResourceSelectActivity = reduxForm({
form: 'SelectActivityForm',
enableReinitialize: true,
onSubmit: async (values, dispatch, props) => {
try {
const data = values.activity;
props.showDescribeActivity(data);
} catch (e) {
// console.log(e.message);
}
},
onChange: (values, dispatch, props) => {
const data = values.activity;
// props.onChangeActivity(data);
props.showDescribeActivity(data);
},
})(ResourceSelectActivity);
Example #3
Source File: ResourceActivityType.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
ResourceActivityType = reduxForm({
form: 'activityTypeForm',
enableReinitialize: true,
onSubmit: (values, dispatch, props) => {
try {
const data = values.activityType;
props.showSelectActivity(data);
} catch (e) {
console.log(e.message);
}
},
})(ResourceActivityType);
Example #4
Source File: ResourceSelectActivity.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
ResourceSelectActivity = reduxForm({
form: 'SelectActivityForm',
enableReinitialize: true,
onSubmit: (values, dispatch, props) => {
try {
const data = values.activity;
props.showDescribeActivity(data);
} catch (e) {
console.log(e.message);
}
},
})(ResourceSelectActivity);
Example #5
Source File: index.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
Creation = reduxForm({
form: 'CreateGroupForm',
enableReinitialize: true,
onSubmit: (values, dispatch, props) => {
try {
const { updateGroup, nextStep } = props;
updateGroup(values);
nextStep();
} catch (e) {
console.log(e.message);
}
},
})(Creation);
Example #6
Source File: index.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 6 votes |
Creation = reduxForm({
form: 'CreateTeamForm',
enableReinitialize: true,
onSubmit: async (values, dispatch, props) => {
try {
const {
updateTeam,
nextStep,
editMode,
handleSubmitInEditMode,
} = props;
await updateTeam(values);
if (editMode) {
handleSubmitInEditMode();
}
if (!editMode) {
nextStep();
}
} catch (e) {
console.log(e.message);
}
},
})(Creation);
Example #7
Source File: SurveyRenderer.jsx From covid19-testing with Apache License 2.0 | 6 votes |
export function connectSurveyForm(reduxFormArgs) {
const originalOnSubmitFail = reduxFormArgs.onSubmitFail;
const onSubmitFail = (errors, dispatch, ...args) => {
if (errors) {
const erroredFields = Object.keys(errors);
if (erroredFields) {
scrollToFormId(erroredFields[0]);
}
dispatch({
type: FIELD_VALIDATION_ERROR,
errors: errors,
});
}
if (originalOnSubmitFail) {
originalOnSubmitFail(errors, ...args);
}
};
const ReduxFormComponent = reduxForm({...reduxFormArgs, onSubmitFail})(
SurveyRenderer
);
return ReduxFormComponent;
}
Example #8
Source File: ResourceDescribeActivity.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 5 votes |
ResourceDescribeActivity = reduxForm({
form: 'describeActivityForm',
enableReinitialize: true,
onSubmit: async (val, dispatch, props) => {
const values = val;
const {
resource,
showBuildActivity,
onSubmitDescribeActivity,
saveFormData,
selectType,
type,
setActiveView,
} = props;
if (!values.metaTitle) {
values.metaTitle = resource.formData.metaTitle;
}
if (typeof values.metaSubject !== 'object' || values.metaSubject === null) {
values.metaSubject = resource.formData.metaSubject;
}
if (typeof values.metaEducationLevels !== 'object' || values.metaEducationLevels === null) {
values.metaEducationLevels = resource.formData.metaEducationLevels;
}
saveFormData(values);
if (val.metaTitle.length === 0) {
Swal.fire('Title is required.');
return;
}
if (values.metaTitle.length > 80) {
Swal.fire('Title must be 80 characters or less');
return;
}
try {
// image validation
if (!resource.newResource.metadata.thumbUrl) {
props.uploadResourceThumbnail(
'https://images.pexels.com/photos/3694708/pexels-photo-3694708.jpeg?auto=compress&cs=tinysrgb&dpr=1&fit=crop&h=200&w=280',
);
}
onSubmitDescribeActivity(values);
showBuildActivity(
resource.newResource.activity.h5pLib,
resource.newResource.activity.type,
);
setActiveView('build');
selectType([...type, 'build']);
} catch (e) {
// console.log(e.message);
}
},
})(ResourceDescribeActivity);
Example #9
Source File: ResourceDescribeActivity.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 5 votes |
ResourceDescribeActivity = reduxForm({
form: 'describeActivityForm',
enableReinitialize: true,
onSubmit,
})(ResourceDescribeActivity);
Example #10
Source File: index.js From ActiveLearningStudio-react-client with GNU Affero General Public License v3.0 | 5 votes |
CreateProjectPopup = reduxForm({
form: 'createProjectForm',
enableReinitialize: true,
onSubmit,
})(CreateProjectPopup);
Example #11
Source File: appWithReduxForm.story.js From rainbow-modules with MIT License | 5 votes |
Form = reduxForm({
validate,
form: 'appWithReduxForm',
})(Content)