Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1790 Why does the server not receive all input from select-option inputs?

You are here: irt.org | FAQ | JavaScript | Form | 7.3 | Q1790 [ previous next ]

Using the "button" element in forms with Opera 5.06b (tested on Linux PC)

<form action="forty_two" method="post">
  <select name="human" size="1">
    <option value="arthur" selected>arthur</option>
  <button type="submit" name="fish" value="thanks">thanx</button>
  <select name="et" size="1">
    <option value="zaphod" selected>zaphod<>
  <button type="submit" name="action" value="send">send</button>

The above form works fine: submitting the form with the second button send human=arthur and et=zaphod and action=send to the server.

Now lets modify the first button, the second button ("send") remains untouched. Submit the form once more with the second button ("send"). If the first ("thanx") button was modified to:

  <button type="submit">send</button>

everything still works fine. But these do not work:

  <button type="button">send</button>
  <button type="button" name="action" value="send">send</button>
  <button type="button">send</button>
  <button name="action" value="send">send</button>

The server receives human=arthur and action=send. et=zaphod is *not* sent!

Conclusion: The type="submit" - attribute of a button-element *must not* be omitted. If it was omitted all name-value-pairs of all select-option-inputs coming up later in the document are not sent to the server. Unfortunately it is not the absence of the type="button|submit|reset" attribute. It has to be type="submit", type="button" will not work. Bad luck if you want to work with e.g. disabled buttons as the following does not work either:

  <button type="submit" name="fish" value="thanks" disabled>thanx</button>

I guess this violates W3C's xhtml 1.0 Spec.Netscape 4.77 Linux e.g. does not care if the type-attribute is missing.

Submitted by Edge

©2018 Martin Webb