Forum Moderators: open

Message Too Old, No Replies

IE and multiple submit buttons

**** is it doing?

         

dingman

4:59 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, actually, I know exactly what it's doing because I sniffed the network traffic, I just don't know why. I have a page which contains a generated form with an arbitrary number of <button type="submit" name="pageNo" value="$foo">$foo+1</button> elements. What this is supposed to do, and in fact does in every other browser, is to submit the form with a diferent value for pageNo depending on which button the user clicks. IE, however, submits the form with every possible value for 'pageNo'.

What do I have to do to make that godawful poor excuse for a browser behave? I can't use <input type="submit" ... /> because of the offset between the display value and the submitted one. (Users don't generally start counting at zero, and might find it confusing.) The page validates as XHTML 1.1 except for a start attribute to an <ol> tag, so that's not the problem.

DrDoc

11:08 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, your only option is to use the <input> form of a submit button. Then, in your script, you can just subtract one from the submitted value.

:)

ShawnR

11:19 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"...page validates ... so that's not the problem..."

As you suspect, it is a bug in IE, not your code.

DrDoc

11:25 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is not just an IE issue. There are other browsers that treat <button> objects as a regular text input field.

ShawnR

11:38 pm on Jun 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What I meant to say was "Its a known bug in IE which has been discussed on this board before.

"...not just an IE issue. There are other browsers that ..."

You're probably right. In which case those other browsers also have the bug. The 'name' attribute of the 'button' tag is specifically in the standard to allow multiple buttons on a form, so you can identify which button got pressed.

dingman

1:42 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks. What other browsers do this? I tried almost my whole arsenal on that page yesterday, and IE was the only one that misbehaved for me. ('course, NN4 doesn't even know what a <button> is for, but it at least degraded the way it was supposed to.) Anyone have the link to the previous discussion on here? I didn't mean to bring up something I could have found

Yech. I had to change the way several other forms were generated as well to change that one, because they all shared the same code for processing that variable.

ShawnR

9:55 pm on Jun 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is one: [webmasterworld.com...]

(From memory I think it was discussed somewhere else as well, but I can't find it right now.) Terms like 'button' and 'form' are so common it is a hard thing to search for ;)