|
|||
|
Misusing the reset-button into submission is fun
<form onreset='this.submit()'> is enough. Changing the action-url is easy: <form onreset='this.action="another.html";this.submit()' > However detecting which button was pressed takes some more action: =============== <script type='text/javascript'> function which(t) { t.form.whichButton.value=t.value; }; </script> <form onsubmit='this.action="a.html";' onreset='this.action="b.html";this.submit()' > <input name='z'> <input type='submit' value='submit 1 to a' onclick='which(this);'> <input type='submit' value='submit 2 to a' onclick='which(this);'> <input type='reset' value='submit 1 to b' onclick='which(this);'> <input type='reset' value='submit 2 to b' onclick='which(this);'> <input type='hidden' name='whichButton'> </form> =============== Chrome on pc tested, not chrome-beta for Ice Cream Sandwich. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) |
|
|
||||
|
||||
|
|
|
|||
|
On 08 Feb 2012 10:04:02 GMT, "Evertjan." wrote:
>Misusing the reset-button into submission is fun >[...] Coming soon to The Daily WTF, no doubt... ![]() -- Ross McKay, Toronto, NSW Australia "The chief cause of problems is solutions" -Eric Sevareid |
|
|||
|
2012-02-08 12:10, Ross McKay wrote:
> On 08 Feb 2012 10:04:02 GMT, "Evertjan." wrote: > >> Misusing the reset-button into submission is fun >> [...] > > Coming soon to The Daily WTF, no doubt... ![]() But what's the point of messings things up in a difficult way, when it can be done so easily? No reason to rely on JavaScript being enabled when you can confuse *everyone* (except source code peekers). <input type=submit name=Cancel> <input type=reset name=Submit> -- Yucca, http://www.cs.tut.fi/~jkorpela/ |
|
|||
|
2012-02-08 12:10, Ross McKay wrote:
> On 08 Feb 2012 10:04:02 GMT, "Evertjan." wrote: > >> Misusing the reset-button into submission is fun >> [...] > > Coming soon to The Daily WTF, no doubt... But what's the point of messings things up in a difficult way, when it can be done so easily? No reason to rely on JavaScript being enabled when you can confuse *everyone* (except source code peekers). <input type=submit value=Cancel> <input type=reset value=Submit> -- Yucca, http://www.cs.tut.fi/~jkorpela/ |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|