1. 10
    Prevent Empty Form Values with Conditional Submit Handlers
    5m 37s

Prevent Empty Form Values with Conditional Submit Handlers

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

We’ll take advantage of the controlled nature of the todo input and the first class nature of javascript functions to dynamically assign the form submission handler. An empty todo will trigger a submission handler that is only concerned with handling an error state, and when the input is valid, the form will use the standard submit handler.

danielpoulson
~ 7 years ago

My Chrome React devtools do not show "bound" and then the function that is bounded they only show "fn"

Andy Van Slaarsinstructor
~ 7 years ago

Have you tried pulling down the repository code to see if it works from the source?

andrew kusuma
~ 5 years ago

Thank you Andy, const submitHandler make sense for me to create UX validation. How about handle multiple input? and show error message when one or all input is empty or wrong format. Do you any idea for that case?

Thank you

dave
~ 4 years ago

Why isn't form validation handled in the form ?