<!-- --><style type="text/css">@import url(https://www.blogger.com/static/v1/v-css/navbar/3334278262-classic.css); div.b-mobile {display:none;} </style> </head><body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d7256432\x26blogName\x3dThe+Frustrated+Programmer\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLACK\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://frustratedprogrammer.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://frustratedprogrammer.blogspot.com/\x26vt\x3d5012862196962223429', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
| Monday, July 19, 2004

Ever have a form with multiple submit buttons? Well, if you hit enter in one of the text inputs, browsers will act like the first button on the form was pressed. Unless, of course, the form only has one text input. Then it doesn't matter if you have several other types of inputs or none at all, IE will not send any button related information to the server. Its very consistent about this across all versions.

If you are using struts your error will look something like this.

javax.servlet.ServletException: Request[{0}] does not contain handler parameter named {1}


Or in Struts 1.2.1 you can overcome this by implementing the method unspecified(...) in your action.

But to avoid it all and make one input act just like multiple inputs, just add a 'hidden' text input:

<input type="text" style="display: none" />

This input will not show in any modern browser, and will force IE to act like the first button on the page was clicked when enter is pressed on this form.