Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #11495 > unrolled thread
| Started by | "Evertjan." <exjxw.hannivoort@interxnl.net> |
|---|---|
| First post | 2012-02-08 10:04 +0000 |
| Last post | 2012-02-08 12:35 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
Misusing the reset-button into submission "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-08 10:04 +0000
Re: Misusing the reset-button into submission Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-02-08 21:10 +1100
Re: Misusing the reset-button into submission "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-02-08 12:35 +0200
| From | "Evertjan." <exjxw.hannivoort@interxnl.net> |
|---|---|
| Date | 2012-02-08 10:04 +0000 |
| Subject | Misusing the reset-button into submission |
| Message-ID | <Xns9FF370953F86Eeejj99@194.109.133.133> |
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)
[toc] | [next] | [standalone]
| From | Ross McKay <au.org.zeta.at.rosko@invalid.invalid> |
|---|---|
| Date | 2012-02-08 21:10 +1100 |
| Message-ID | <1gi4j7dcb3kcvvi3ccsuae9sd7t5128a6l@4ax.com> |
| In reply to | #11495 |
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
[toc] | [prev] | [next] | [standalone]
| From | "Jukka K. Korpela" <jkorpela@cs.tut.fi> |
|---|---|
| Date | 2012-02-08 12:35 +0200 |
| Message-ID | <jgtj5e$kbu$3@dont-email.me> |
| In reply to | #11496 |
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/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web