Misusing the reset-button into submission


E

Evertjan.

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.
 
Ad

Advertisements

J

Jukka K. Korpela

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>
 
Ad

Advertisements

J

Jukka K. Korpela

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top