I am using react-final-form to develop a multi-page wizard form but am now stuck on sending my submissions to Netlify.
Netlify has detected my form but on submit doesn't receive my forms data
This is my first time using Netlify to handle form submissions so I'm not sure if I'm doing something
wrong on Netlifys side or react-final-forms side.
important
im using GATSBY
index.js
<Wizard onSubmit={onSubmit}>
<Wizard.Page>
<div>
<div>
<label css={label}>> Name</label>
</div>
<Field
autocomplete="off"
css={input}
name="Name"
component="input"
type="text"
placeholder="$"
validate={required}
/>
<Error name="Name" />
</div>
<div>
<div>
<label css={label}>> Email</label>
</div>
<Field
autocomplete="off"
css={input}
name="Email"
component="input"
type="email"
placeholder="$"
validate={required}
/>
<Error name="Email" />
</div>
<div>
<div>
<label css={label}>> Social handle</label>
</div>
<Field
autocomplete="off"
css={input}
name="Social"
component="input"
type="text"
placeholder="$"
/>
<Error name="Social" />
</div>
</Wizard.Page>
<Wizard.Page>
<div>
<div>
<label css={label}>> What can we do for you?</label>
</div>
<div>
<label
style={{
display: 'flex',
alignItems: 'center',
paddingTop: '0.5em',
}}
>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="Shopify build"
/>{' '}
<span css={checkboxlabel}>Shopify build</span>
</label>
</div>
<div>
<label style={{ display: 'flex', alignItems: 'center' }}>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="pop-up store"
/>{' '}
<span css={checkboxlabel}>Pop-up store</span>
</label>
</div>
<div>
<label style={{ display: 'flex', alignItems: 'center' }}>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="WebVR"
/>{' '}
<span css={checkboxlabel}>WebVR</span>
</label>
</div>
<div>
<label style={{ display: 'flex', alignItems: 'center' }}>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="Website audit"
/>{' '}
<span css={checkboxlabel}>Website audit</span>
</label>
</div>
<div>
<label style={{ display: 'flex', alignItems: 'center' }}>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="Asset creation"
/>{' '}
<span css={checkboxlabel}>Asset creation</span>
</label>
</div>
<div>
<label style={{ display: 'flex', alignItems: 'center' }}>
<Field
css={checkbox}
onClick={play}
name="services"
component="input"
type="checkbox"
value="Other"
/>{' '}
<span css={checkboxlabel}>Other</span>
</label>
</div>
</div>
<div>
<div style={{ paddingTop: '1em' }}>
<label css={label}>> Budget</label>
</div>
<Field css={budget} name="Budget" component="select">
<option />
<option value="UNDER > $3000">UNDER > $3000</option>
<option value="$3000 - $10000">$3000 - $10000</option>
<option value="$10000 - $15000">$10000 - $15000</option>
<option value="$15000 - $25000">$15000 - $25000</option>
<option value="$25000+">$25000+</option>
</Field>
<Error name="budget" />
</div>
</Wizard.Page>
<Wizard.Page>
<div>
<div>
<label css={label}>> Message</label>
</div>
<Field
css={message}
name="message"
component="textarea"
placeholder="$"
/>
<Error name="message" />
</div>
</Wizard.Page>
Wizard.js
handleSubmit = values => {
const { children, onSubmit } = this.props
const { page } = this.state
const isLastPage = page === React.Children.count(children) - 1
if (isLastPage) {
return onSubmit(values)
} else {
this.next(values)
}
}
render() {
const { children } = this.props
const { page, values } = this.state
const activePage = React.Children.toArray(children)[page]
const isLastPage = page === React.Children.count(children) - 1
return (
<Form
autocomplete="off"
initialValues={values}
validate={this.validate}
onSubmit={this.handleSubmit}
>
{({ handleSubmit, submitting, values }) => (
<form name="notypo-services" method="POST" data-netlify="true" onSubmit={handleSubmit}>
{activePage}
<div className="buttons">
{page > 0 && (
<div onClick={this.previous}>
<PrevButton></PrevButton>
</div>
)}
{!isLastPage && (
<NextButton></NextButton>
)}
{isLastPage && (
<div type="submit">
<SendButton></SendButton>
</div>
)}
</div>
</form>
)}
</Form>
)
}
Your <form> tag should have an action and the data provided should have a key-value pair:
<form name="notypo-services"
method="POST"
data-netlify="true"
action="/"
onSubmit={handleSubmit}>
And your data should be structured like:
form-name: "notypo-services"
Name: "Your typed name"
Email: "Your typed email"
Note the form-name value. It's mandatory.
If you don't have a thank-you page, you can redirect the action to himself by /.
In addition, I would suggest adding data-netlify-honeypot to avoid spam.
You can check the Netlify documentation for further details.
after days of procrastinating, I finally put this together
On submit I transfer my data into a hidden form that then gets sent over to Netlify (succesfully)
handleSubmit = values => {
const { children, onSubmit } = this.props
const { page } = this.state
const isLastPage = page === React.Children.count(children) - 1
if (isLastPage) {
document.getElementById("realFormName").value = "notypo-services";
document.getElementById("realName").value = values.Name ;
document.getElementById("realEmail").value = values.Email;
document.getElementById("realSocial").value = values.Social;
document.getElementById("realServices").value = values.Services;
document.getElementById("realBudget").value = values.Budget;
document.getElementById("realMessage").value = values.Message;
document.getElementById("myForm").submit() ;
return false ;
} else {
this.next(values)
}
}
<form id="myForm" name="notypo-services" method="POST" data-netlify="true" data-netlify-honeypot="bot-field" action="/" style={{display: 'none'}}>
<input hidden="true" name="form-name" type="text" id="realFormName" />
<input hidden="true" name="Name" type="text" id="realName" />
<input hidden="true" name="Email" type="email" id="realEmail" />
<input hidden="true" name="Social" type="text" id="realSocial" />
<input hidden="true" name="Services" type="text" id="realServices" />
<input hidden="true" name="Budget" type="text" id="realBudget" />
<input hidden="true" name="Message" type="text" id="realMessage" />
<input hidden="true" type="submit" value="Submit" />
</form>
Related
I wanted to have a dynamic form, so I followed this video (https://www.youtube.com/watch?v=me1kY_uFe5k) to utilize Formik remove and push method.
Now the browser is able to render all the data, but when I click on the "Delete" button or the "Add" button, nothing happened. There are also no error message so I did not know how to debug/fix it.
Note: When I review the tutorial video, I found the author used "values" (as default Props) to retrieve data. I did not go this way. Could it be the root cause? What is the use case of "values"? The video author used "values" but he did not explain why it was used.
function CreateTestSuite3() {
const initialValues = {
testSuite: {
tsId: 0,
tsName: "",
tsDescription: "",
testCases: [
{
testCaseNumber: 0,
testCaseName: "",
testCaseEnvironment: "",
testCaseSQL: ""
}
]
}
};
const onSubmit = (data) => {
console.log("this is form data: ", data);
axios.post("http://localhost:8080/TestSuite/CreateTestSuite", data)
.then((response) => {
console.log("Form Submitted");
})
};
return (
<div className="CreateTestSuite">
<Formik initialValues={initialValues} onSubmit={onSubmit}>
<Form className="formContainer">
<label>Test Suite Id: </label>
<ErrorMessage name="tsId" component="span" />
<Field autoComplete="off" name="testSuite.tsId" placeholder="tsId" />
<label>Test Suite Name: </label>
<ErrorMessage name="tsName" component="span" />
<Field autoComplete="off" name="testSuite.tsName" placeholder="tsName" />
<label>Test Suite Description: </label>
<ErrorMessage name="tsDescription" component="span" />
<Field autoComplete="off" name="testSuite.tsDescription" placeholder="tsDescription" />
<FieldArray name="testSuite.testCases">
{({push, remove, }) => (
<>
{initialValues.testSuite.testCases.map((TestCase, index) => (
<div key={index}>
<label>Test Case Number: </label>
<Field name={`TestCase.${index}.testCaseNumber`} placeholder="testCaseNumber" ></Field>
<label>Test Case Name: </label>
<Field name={`TestCase.${index}.testCaseName`} placeholder="testCaseName" ></Field>
<label>Test Case Environment: </label>
<Field name={`TestCase[${index}].testCaseEnvironment`} placeholder="testCaseEnvironment" ></Field>
<label>Test Case SQL: </label>
<Field name={`TestCase[${index}].testCaseSQL`} placeholder="testCaseSQL" ></Field>
<button type="button" onClick={() => remove(index)} >Delete</button>
</div>
))}
<button type="button" onClick={() => push({ testCaseNumber: 0, testCaseName: "", testCaseEnvironment: "", testCaseSQL: "" })}>Add Test Case</button>
</>
)}
</FieldArray>
<button type="submit">Create Test Suite</button>
</Form>
</Formik>
</div>
)
}
Add and remove is not working since your rendering using the initial values and not the updated values.
Please refer the below code.
<Formik initialValues={initialValues} onSubmit={onSubmit}>
{(formik) => {
const { values } = formik;
return (
<Form className="formContainer">
<label>Test Suite Id: </label>
<Field
autoComplete="off"
name="testSuite.tsId"
placeholder="tsId"
/>
<label>Test Suite Name: </label>
<Field
autoComplete="off"
name="testSuite.tsName"
placeholder="tsName"
/>
<label>Test Suite Description: </label>
<Field
autoComplete="off"
name="testSuite.tsDescription"
placeholder="tsDescription"
/>
<FieldArray
type="testSuite.testCases"
name="testSuite.testCases"
id="testSuite.testCases"
value={values.testSuite.testCases}
render={(arrayHelpers) => (
<div className="formContainer">
{values.testSuite.testCases.map((TestCase, index) => (
<div className="formContainer" key={index}>
<label>Test Case Number: </label>
<Field
name={`TestCase.${index}.testCaseNumber`}
placeholder="testCaseNumber"
></Field>
<label>Test Case Name: </label>
<Field
name={`TestCase.${index}.testCaseName`}
placeholder="testCaseName"
></Field>
<label>Test Case Environment: </label>
<Field
name={`TestCase[${index}].testCaseEnvironment`}
placeholder="testCaseEnvironment"
></Field>
<label>Test Case SQL: </label>
<Field
name={`TestCase[${index}].testCaseSQL`}
placeholder="testCaseSQL"
></Field>
<button
type="button"
onClick={() => arrayHelpers.remove(index)}
>
Delete
</button>
</div>
))}
<button
type="button"
onClick={() => {
console.log("hit");
arrayHelpers.insert({
testCaseNumber: 0,
testCaseName: "",
testCaseEnvironment: "",
testCaseSQL: ""
});
}}
>
Add Test Case
</button>
</div>
)}
/>
<button type="submit">Create Test Suite</button>
</Form>
);
}}
</Formik>
Code Sandbox: https://codesandbox.io/s/frosty-platform-ty83no?file=/src/App.js:527-3738
I have a form (react-hook-form) for update data with two options radio.
In this form I can read datas and display it.
But when I want to change the value, my interface doesn't update the display.
Where am I wrong?
Here is my code snippet :
<Controller
name={`evaluations.${index}.check`}
control={control}
render={({ field }) => {
return (
<>
<div className={'radioCheck'}>
<input
{...field}
style={{ display: "none" }}
type='radio'
name={auditEval.checkpoint?.id.toString()}
id={`ok${auditEval.checkpoint?.id}`}
value={'true'}
defaultChecked={auditEval.check == true}
/>
<label htmlFor={`ok${auditEval.checkpoint?.id}`}>
<FontAwesomeIcon icon={faCheck} />
</label>
</div>
<div className={'radioCross'}>
<input
{...field}
style={{ display: "none" }}
type='radio'
name={auditEval.checkpoint?.id.toString()}
id={`nok${auditEval.checkpoint?.id}`}
value={'false'}
defaultChecked={auditEval.check == false}
/>
<label htmlFor={`nok${auditEval.checkpoint?.id}`}>
<FontAwesomeIcon icon={faX} />
</label>
</div>
</>
)
}}
/>
I am a beginner to Formik forms and Yup Validation, However I am working on this form and I am not able to make the form submit successfully. I will appreciate your help what's going wrong in my code and why it's not submitting ?
my Yup validation (might not be the problem)
const validate = Yup.object({
name: Yup.string()
.max(20, "Must be 20 characters or less" )
.required('required'),
school: Yup.string("required name").required('Please select your school').oneOf(schools),
jobType: Yup.string().required("are you a student or a staff member ?!"),
parentName: Yup.string().required("enter parent name"),
parentPhone: Yup.number().required("Enter phone number"),
parentEmail: Yup.string().email().required("enter parent Email"),
staffPhone: Yup.string().required("enter staff Phone number"),
staffEmail: Yup.string().email().required("enter staff Email"),
condition: Yup.string().required("Please chose one").oneOf(condition)
})
My formik tag, the only thing in the return statement
<Formik
initialValues ={{
name: '',
school: '',
jobType: '',
// isStudent:'student',
// isStaffMember:'staffMember',
parentName: "",
parentPhone: '',
parentEmail: '',
staffPhone:'',
staffEmail: '',
condition:'',
...signupVals
}}
onSubmit={(values, { setSubmitting }) => {
setTimeout(() => {
console.log("Logging in", setSubmitting);
setSubmitting(false);
}, 500);
}}
validationSchema={validate}
// onSubmit={async (values) => {
// await new Promise((r) => setTimeout(r, 500));
// Window.alert(JSON.stringify(values, null, 2));
// }}
>
{({values, errors, touched, isValidating, isSubmitting}) => (
<>
{console.log(values)}
{console.log("submit ", isSubmitting)}
{console.log("validate ", isValidating)}
<div>
<h1 className=" my-4 font-weight-bold-display-4">
Sign Up
</h1>
<Form >
<div className='my-4'>
<label className="form-label" >Name: </label>
<Field className="ms-2" label ="name" name="name" type="text" id="exampleFormControlInput1" />
<ErrorMessage name="name" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
{/* {errors} */}
</div>
<div className='my-4'>
<label>School: </label>
<Field className="ms-2" label ="school" as="select" name="school" >
<option />
<option>Aim Academy</option>
<option>Beyond Academy</option>
<option>Curiousity Academy</option>
<option>Discover Academy</option>
<option>Explore Academy</option>
</Field>
<ErrorMessage name="school" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
</div>
<div id="my-radio-group" className='my-4'>Job type</div>
<ErrorMessage name="jobType" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
<div role="group" aria-labelledby="my-radio-group" >
<div className='my-4'>
<label >
<Field className="px-2" type="radio" name="jobType" value="student" onClick={handleIsStudent}/>
Student
</label>
</div>
<div className='my-4'>
<label>
<Field type="radio" name="jobType" value="staff member" onClick={handleIsStaff} />
Staff member</label>
</div>
{isStudent ?<>
<label > Parent name
<Field className=" my-3 ms-2" type="input" name="parentName" />
<ErrorMessage name="parentName" component='inline-block' style={{color:"red" , fontSize:"12px"}}/>
</label>
<label> Parent Phone
<Field className=" my-3 ms-2" type="input" name="parentPhone" />
<ErrorMessage name="parentPhone" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
</label>
<label> Parent Email
<Field className=" my-3 ms-2" type="input" name="parentEmail" />
<ErrorMessage name="parentEmail" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
</label>
</>: null}
{isStaff ?<>
<label> staff phone
<Field className=" my-3 ms-2" type="input" name="staffPhone" />
<ErrorMessage name="staffPhone" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
</label>
<label> staff Email
<Field className=" my-3 ms-2" type="input" name="staffEmail" />
<ErrorMessage name="staffEmail" component='inline-block' style={{color:"red" , fontSize:"12px"}}/>
</label>
</>: null}
<div className='my-4'>
<label>Condition: </label>
<Field className="ms-2" label ="Condition" as="select" name="condition" >
<option />
<option>Experiencing Symptoms</option>
<option>Tested positive for Covid</option>
</Field>
<ErrorMessage name="condition" component='inline-block' style={{color:"red" , fontSize:"12px"}} />
</div>
</div>
<button className="btn btn-dark mt-3" type="submit" > Register</button>
<button className="btn btn-danger mt-3 ml-3" type="submit" > Reset</button>
{/* {console.log(values)} */}
<TextField {...values} />
</Form>
</div>
</>
)}
</Formik>
To my understanding wrapping the inside will allow the form to fire automatically the onSubmit handler function I have! but I am not sure and would appreciate your help to figure this out?!
I don't think it's a good practice to submit your form every 500ms. With that said, I'll suggest moving the form into it's own component and using useFormikContext move the autosubmit into an useEffect:
Refactor to follow this structure:
<Formik ...>
<NewComponent/>
</Formik>
In the NewComponent paste all the field of your form
In the NewComponent get the context of values and handleSubmit:
const { values, handleSubmit } = useFormikContext();
Also in the NewComponent add a new useEffect:
useEffect(() => {
handleSubmit();
}, [values]);
That will give you an auto-submit, every time the users modify something in the fields. You can easily add the 500ms submit here too!
Here's the example:
I am trying to call the render Input method from render Hobbies method but it is giving an error saying that the render Input property is undefined. I'm not getting the exact issue. It would be great if someone could tell me what is the problem in my code ? Thanks in advance.
Here's the code:
UserForm.js
import React, { Component } from 'react'
import { Field, reduxForm,FieldArray } from 'redux-form'
import Multiselect from 'react-widgets/lib/Multiselect'
import 'react-widgets/dist/css/react-widgets.css'
class UserForm extends Component {
renderInput(formProps) {
const className = `field ${formProps.meta.error && formProps.meta.touched ?
'error' : ''}`
return (
<div className={className}>
<label>{formProps.label}</label>
<input {...formProps.input} type={formProps.type} max={formProps.max} autoComplete='off'
label={formProps.label} id={formProps.id} placeholder={formProps.placeholder}
checked={formProps.input.value} value={formProps.input.value} />
{formProps.meta.touched &&
(formProps.meta.error && <span>{formProps.meta.error}</span>)}
</div>
)
}
renderMultiselect({ input, ...rest }) {
return (<Multiselect {...input}
onBlur={() => input.onBlur()}
value={input.value || []}
{...rest} />)
}
renderHobbies({ fields, meta: { error } }) {return(
<ul>
<li>
<button type="button" onClick={() => fields.push()}>Add Hobby</button>
</li>
{fields.map((hobby, index) =>
<li key={index}>
<button
type="button"
title="Remove Hobby"
onClick={() => fields.remove(index)}/>
<Field
name={hobby}
type="text"
component={this.renderInput}
label={`Hobby #${index + 1}`}/>
</li>
)}
{error && <li className="error">{error}</li>}
</ul>
)
}
onSubmit = (formValues) => {
console.log('formValues', formValues)
this.props.onSubmit(formValues)
}
render() {
const { handleSubmit } = this.props
const current = new Date().toISOString().split("T")[0]
let optionsList = [{ id: 1, name: 'Travelling' }, { id: 2, name: 'Reading' }, { id: 3, name: 'Gaming' }]
let items = [{ name: 'Travelling', value: 'Travelling' }, { name: 'Reading', value: 'Reading' }, { name: 'Gaming', value: 'Gaming' }]
const colleges = ['Pune University', 'S.P.College', 'F.C College']
return (
<div className='container'>
<form onSubmit={handleSubmit(this.onSubmit)}
className='ui form error'>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>FullName</label>
<div className='col-sm-10'>
<Field name='fullname' component={this.renderInput}
type='text' className='form-control' placeholder='Full Name'
validate={[required, minLength3]} />
</div>
</div>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>Address</label>
<div className='col-sm-10'>
<Field name='address' component={this.renderInput}
type='text' placeholder='Address'
validate={[required, maxLength25]} />
</div>
</div>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>BirthDate</label>
<div className='col-sm-10'>
<Field
name='birthdate'
type='date'
max={current}
component={this.renderInput}
validate={required}
/>
</div>
</div>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>Select Your Gender</label>
<div className='col-sm-1 ui radio'>
<div className='form-check'>
<label className='form-check-label'>Male</label>
<Field name='gender' component='input' type='radio' value='male'
className='ui input' />{' '}
</div>
<div className='form-check'>
<label className='form-check-label'>Female</label>
<Field name='gender' component='input' type='radio' value='female'
/>{' '}
</div>
<div className='form-check'>
<label className='form-check-label'>Other</label>
<Field name='gender' component='input' type='radio' value='other'
/>{' '}
</div>
</div>
</div>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>Select Your Hobbies</label>
<div className='col-sm-10'>
<Field
name='hobbies'
component={this.renderMultiselect}
data={['Travelling', 'Gaming', 'Reading', 'Drawing']} />
</div>
<div>
<FieldArray name='hobbies' component={this.renderHobbies}/>
</div>
</div>
<div className='row mb-3'>
<label className='col-sm-2 col-form-label'>Select College</label>
<div className='col-sm-10'>
<Field name='college' component='select' placeholder='Select College' validate={required}>
<option value="">Select a college</option>
{colleges.map(collegeOption => (
<option value={collegeOption} key={collegeOption}>
{collegeOption}
</option>
))}
</Field>
</div>
</div>
<button type='submit' className='ui button'>Submit</button>
</form>
</div>
)
}
}
const required = value => (value || typeof value === 'number' ? undefined : 'Required')
const maxLength = max => value => value && value.length > max ? `Must be ${max} characters
or less`: undefined
const maxLength25 = maxLength(25)
const minLength = min => value => value && value.length < min ? `Must be ${min} characters or
more`: undefined
const minLength3 = minLength(3)
export default reduxForm({
form: 'userform'
})(UserForm)
That's the scope problem,
this is undefined in renderHobbies.
just binding the renderHobbies will work
<div>
<FieldArray name='hobbies' component={this.renderHobbies.bind(this)}/>
</div>
import React from 'react';
import { Link } from 'react-router';
import { Field } from 'redux-form';
import BaseForm from '..//BaseForm';
export default class XXXXXXX extends BaseForm {
componentWillMount() {
this.props.retrieveAcademies();
}
render() {
const {
handleSubmit,
formatGraduationDate,
pristine,
submitting,
infoError,
acadamyId
} = this.props;
return (
<div className="col-md-8 col-lg-8 mscs-text">
<div>
<h1 className="mscs-head">Self Registration </h1> <hr />
<form onSubmit={handleSubmit(this.props.startRegistrationProcess.bind(this))} className="registration-step1Class">
<div className="form-section">
<label htmlFor="firstName">First Name:</label>
<Field name="firstName" component={this.renderInputield} label="Enter first Name:" />
</div>
<div className="form-section">
<label htmlFor="lastName">Last Name:</label>
<Field name="lastName" component={this.renderInputield} label="Enter last Name:" />
</div>
<div id="datetimepicker2" className="form-section">
<label htmlFor="dob">Date of Birth:</label>
<Field name="dob" component={this.renderReactDatePicker} type="text" />
</div>
<div className="form-section">
<label htmlFor="maritimeAcadamy">Maritime Academy:</label>
{this.renderAcademiesSelection(acadamyId)}
</div>
<div className="form-section">
<label htmlFor="Yearpassed">Year Passed:</label>
<Field name="passedYear"
component={this.renderReactDatePicker}
type="text"
formatDate={formatGraduationDate}
/>
</div>
<br />
<div className="form-section">
<label htmlFor="CustomerNumber">Customer ID:</label>
<Field name="CustomerNumber" component={this.renderInputield} type="text" label="Enter Customer ID:" />
</div>
<div className="error validation-error">
{infoError && infoError.error} <br />
</div>
<input type="submit" className="btn btn-success" value="Next" />
<input type="reset" className="btn btn-default" value="Cancel" />
</form>
</div>
</div>
);
}
renderAcademiesSelection(acadamyId) {
return (
<div>
<select className="form-control" {...acadamyId}>
<option key={0} value={''}>{'Select your academy'}</option>
{
this.props.academies && this.props.academies.map(function (item, index) {
return (
<option key={item.Id} value={item.Id}>{item.Name}</option>
);
})
}
</select>
</div>
);
}
}
This is the component. Below is the container. The code has some textboxes and dropdowns and calendar controls.
Container :
function mapStateToProps(state, ownProps) {
return {
academies: state.academies.academies,
infoError: state.signUp.error
};
}
const mapDispatchToProps = (dispatch, ownProps) => {
return {
retrieveAcademies: () => {
dispatch(retrieveAcademies());
},
startRegistrationProcess: dispatchGenerateRegistrationToken.bind(this),
nextPage: ownProps.nextPage,
}
}
The above code samples are my react component and container. When I am clicking on the Next button it is not taking me to the next step and it is not showing any type of error in the console. I don't know where exactly the mistake is. I can't debug since the console is not giving any type of error. Any help is appreciated here.