Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function onSubmit(event){
  2. event.preventDefault(); // BASICALLY DON'T SUBMIT ANYTHING AND LET MY CODE HANDLE THIS
  3. touchAllInputsValidateAndSubmit();
  4. return;
  5. }
  6.  
  7. function SomeFormComponent() {
  8. const [formState,setFormState] = useState(); // STORE FORM INPUT VALUES IN STATE
  9.  
  10. function handlePseudoSubmit() {
  11. callCloudFunction(formState); // ON SUBMIT, PASS THE FORMSTATE TO A CLOUD FUNCTION
  12. }
  13.  
  14. return(
  15. <React.Fragment>
  16.  
  17. // Clickable divs for checkboxes
  18. // Regular inputs
  19. // Can use contenteditable divs
  20. // Whatever you can think of that could be part of a form
  21.  
  22. <button onClick={handlePseudoSubmit}>
  23. Click to PseudoSubmit
  24. </button>
  25.  
  26. </React.Fragment>
  27. );
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement