最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Have only one button submit form? - Stack Overflow

programmeradmin2浏览0评论

I have inherited a project and there is a form with 3 buttons:

<input type="submit" id="ctl00_contentPlaceHolder_back" value="Make Changes" name="ctl00$contentPlaceHolder$back" onClick="history.back();">
<input type="submit" id="ctl00_contentPlaceHolder_preview" value="View Outside" name="ctl00$contentPlaceHolder$preview">
<input type="submit" id="ctl00_contentPlaceHolder_submit" value="Send Card" name="ctl00$contentPlaceHolder$submit">

How do I make it so, that only 1 button actually submits the form to another page for processing?

I have inherited a project and there is a form with 3 buttons:

<input type="submit" id="ctl00_contentPlaceHolder_back" value="Make Changes" name="ctl00$contentPlaceHolder$back" onClick="history.back();">
<input type="submit" id="ctl00_contentPlaceHolder_preview" value="View Outside" name="ctl00$contentPlaceHolder$preview">
<input type="submit" id="ctl00_contentPlaceHolder_submit" value="Send Card" name="ctl00$contentPlaceHolder$submit">

How do I make it so, that only 1 button actually submits the form to another page for processing?

Share Improve this question edited Feb 8, 2011 at 16:16 Kris Erickson 33.9k26 gold badges121 silver badges179 bronze badges asked Feb 8, 2011 at 14:59 KeithKeith 26.5k36 gold badges98 silver badges129 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

Change all the other ones to type="button"

Change the input type="button" instead of type="submit". These kind of look like ASP controls, so find and replace these form buttons with a plain button, unbound.

By not letting them be submit buttons. Use type="button" instead of type="submit".

发布评论

评论列表(0)

  1. 暂无评论