Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.java.* > Newsgroup comp.lang.javascript

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2012, 09:04 AM
Evertjan.
Guest
 
Posts: n/a
Default Misusing the reset-button into submission

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)
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 02-08-2012, 09:10 AM
Ross McKay
Guest
 
Posts: n/a
Default Re: Misusing the reset-button into submission

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
Reply With Quote
  #3 (permalink)  
Old 02-08-2012, 09:34 AM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: Misusing the reset-button into submission

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/
Reply With Quote
  #4 (permalink)  
Old 02-08-2012, 09:35 AM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: Misusing the reset-button into submission

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/
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 06:08 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.