Sreekar Mouli
Sreekar Mouli

Reputation: 1432

Forms in Material-UI, Reactjs

I am trying to build a Registration Form using Material-UI and Reactjs.

In my code, the input validation and required attribute seems to be not working for a <TextField /> component of Material-UI.

With a normal <input /> component, the validation is happening (see below pictures).

You can find my code in this sandbox:

Edit purple-wave-0rx9o


input validation 1

input validation 2

Upvotes: 0

Views: 1367

Answers (1)

reflexgravity
reflexgravity

Reputation: 970

A button should have a type="submit" attribute to specify that you are doing a form submission on the click of the button. In material-ui by default type="button". So you need to specify the type of the button to make it work. I have fixed it here

Upvotes: 2

Related Questions