Skip to content
Snippets Groups Projects
Commit caf1d22d authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Add Aup checkbox to the form

parent d7fa8a0a
No related branches found
No related tags found
1 merge request!16WIP: Feat React frontend
...@@ -22,6 +22,7 @@ function Main(props) { ...@@ -22,6 +22,7 @@ function Main(props) {
const [validated, setValidated] = useState(false); const [validated, setValidated] = useState(false);
const [modalTitle, setModalTitle] = useState("Your account request has been submitted."); const [modalTitle, setModalTitle] = useState("Your account request has been submitted.");
const [modalBody, setModalBody] = useState(<Spinner animation="border" variant="success" />); const [modalBody, setModalBody] = useState(<Spinner animation="border" variant="success" />);
const [aup, setAup] = useState(false);
// Setup refs for easy access // Setup refs for easy access
const socketRef = useRef(null); const socketRef = useRef(null);
...@@ -32,6 +33,9 @@ function Main(props) { ...@@ -32,6 +33,9 @@ function Main(props) {
// Define functions // Define functions
const hideModal = () => setIsLoading(false); const hideModal = () => setIsLoading(false);
const showModal = () => setIsLoading(true); const showModal = () => setIsLoading(true);
const handleAup = (e) => {
setAup(!aup)
}
const handleSubmit = (e) => { const handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
...@@ -46,7 +50,8 @@ function Main(props) { ...@@ -46,7 +50,8 @@ function Main(props) {
'username': username, 'username': username,
'firstName': firstName.current.value, 'firstName': firstName.current.value,
'lastName': lastName.current.value, 'lastName': lastName.current.value,
'reason': reason.current.value 'reason': reason.current.value,
'aup': aup
}); });
} }
} }
...@@ -124,8 +129,14 @@ function Main(props) { ...@@ -124,8 +129,14 @@ function Main(props) {
<Form.Label>Reason</Form.Label> <Form.Label>Reason</Form.Label>
<Form.Control ref={reason} type="text" placeholder="Reason" /> <Form.Control ref={reason} type="text" placeholder="Reason" />
</Form.Group> </Form.Group>
<Form.Group controlId="formAUP">
<Form.Check onClick={handleAup} type="checkbox" label="Agree to proceed" />
<Form.Control.Feedback type="invalid">
Required
</Form.Control.Feedback>
</Form.Group>
<Form.Group controlId="formReason"> <Form.Group controlId="formReason">
<Button variant="success" type="submit"> <Button disabled={!aup} variant="success" type="submit">
Submit Submit
</Button> </Button>
</Form.Group> </Form.Group>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment