Given the following two buttons:
<button type="submit" name="MyButton" value="Foo">Do Foo</button>
<button type="submit" name="MyButton" value="Bar">Do Bar</button>
When clicking these buttons, all browsers except IE7 and below will post the button's value ("Foo" or "Bar"), whereas IE7 and below instead post the text ("Do Foo" or "Do Bar").
(This is an MVC project, but the issue is not specific to MVC.)
This thread has a lot of answers, but none of them will work when:
- The value and text are different, and
- JavaScript is disabled
We want to support flexible button text so that business can change these through our CMS without a code change. So we can't assume that our text and values will be the same. But we also don't want to depend on JavaScript to solve this.
However, I can't think of any way to solve this without either requiring JavaScript, or keeping the value and text the same.