Browse Source

update useformik and get values by useEffect from formik form

master
Alex Cheung 2 years ago
parent
commit
704ffafa57
2 changed files with 812 additions and 812 deletions
  1. +8
    -8
      src/pages/authentication/Register.js
  2. +804
    -804
      src/pages/authentication/auth-forms/CustomFormWizard.js

+ 8
- 8
src/pages/authentication/Register.js View File

@@ -48,12 +48,12 @@ const steps = ['個人資料', '預覽', '完成提交'];
const Register = () => { const Register = () => {
const [activeStep, setActiveStep] = useState(0); const [activeStep, setActiveStep] = useState(0);
const [completed, setCompleted] = useState([false]); const [completed, setCompleted] = useState([false]);
// const [isValid, setisValid] = useState(false);
const [isValid, setisValid] = useState(null);


// const handleIsValidChange = (value) => {
// setisValid(value);
// console.log(value)
// };
const updateValid = (value) => {
setisValid(value);
console.log(value)
};


const totalSteps = () => { const totalSteps = () => {
return steps.length; return steps.length;
@@ -139,8 +139,8 @@ const Register = () => {
) : ( ) : (
<React.Fragment> <React.Fragment>
<AuthWrapper> <AuthWrapper>
{/* <CustomFormWizard onIsValidChange={handleIsValidChange} step={activeStep} /> */}
<CustomFormWizard step={activeStep} />
<CustomFormWizard updateValid={updateValid} step={activeStep} />
{/* <CustomFormWizard step={activeStep} /> */}
</AuthWrapper> </AuthWrapper>
<Stack direction="row" sx={{ pt: 2 }}> <Stack direction="row" sx={{ pt: 2 }}>
{ activeStep === totalSteps() - 1 ? ( { activeStep === totalSteps() - 1 ? (
@@ -177,7 +177,7 @@ const Register = () => {
</Button> </Button>
): ):
( (
<Button onClick={handleNext} sx={{ mr: 1 }}>
<Button disabled={isValid===false} onClick={handleNext} sx={{ mr: 1 }}>
繼續 繼續
</Button> </Button>
) )


+ 804
- 804
src/pages/authentication/auth-forms/CustomFormWizard.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save