Re: Users' unintentional use of "Enter" causing data loss
bbbart <[email protected]> Wed, 22 Mar 2006 10:17:11 +0100
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
Quoting bugant <[email protected]>: > hi, > > Joel Palmius wrote: > > You are pointing at a bug though. The user should be notified that > > his key is illegal when submitting. Did this not happen? > > so maybe setting the last question as mandatory (MUSTANSWER="yes") > should do the trick ;) hehe, that's a nice one :-) but your enver sure if a user fills in a survey top-to-bottom. > > BugAnt: You did some stuff with key bindings for answering a > > survey. Any way to prevent enter from submitting form? > > I think you could use javascript to prevent this. > > function noSub(e) { > var realkey = String.fromCharCode(e.which); > var nkey=e.which; > if (nkey == 13) { > alert('You've pressed return'); > return; > } > } what do you use the var realkey for? and, are you sure that this would prevent submitting the form? I'm not sure how the browser would handle the 'enter' event after processing the javascript. if it is possible to 'take away' the binding between an event and an accesskey just by binding the accesskey to some other event, maybe it would be easier to use XHTML's accesskey property at some point other that the submit button. but then again, what event would be preferred... to me, the best way is to either make all the answers mandatory (MUSTANSWER=yes) or, if that is not desirable, to educate your users. :-) -- greetings, BBBart Skickat av bbbart <[email protected]> till survey-discussion