4thSpace
4thSpace

Reputation: 44312

How to use button for submitting form?

I have an asp.net mvc form with a button that is used for submitting the form. The problem is the button doesn't do anything. I'm using the Bootstrap framework for styling.

This doesn't work:

<button type=button class="btn btn-success btn-block">Send It</button>

But if I add this, it works:

<input type="submit" value="submit"/>

Is there a way to use the Bootstrap styled button for submitting the form?

Upvotes: 1

Views: 50

Answers (2)

Shaggy
Shaggy

Reputation: 6796

A button of type button has no behaviour attached to it by default. To submit a form you should use the submit type, instead.

<button type="submit" class="btn btn-success btn-block">Send It</button>

Upvotes: 1

dotnetom
dotnetom

Reputation: 24901

Just change yout button type to submit:

<button type="submit" class="btn btn-success btn-block">Send It</button>

Upvotes: 2

Related Questions