Re: what to do with the <return> key
Re: what to do with the <return> key
- Subject: Re: what to do with the <return> key
- From: Fabian Peters <email@hidden>
- Date: Tue, 6 Mar 2007 01:08:12 +0100
Hi,
Am 06.03.2007 um 00:03 schrieb Ian Joyner:
That's nifty because you wouldn't have to attach the JavaScript to
every text field.
In a similar vein, it may be useful to "redirect" a submit on the
form like this:
<form method="post" onSubmit="Event.stop(event); $('submit').click();
return;" ...>
I've been using this with Wonder's AJAX submit buttons so that one
(id="submit") responds to the enter key. I never tested it with
"normal" submit buttons, though...
cheers
Fabian
Ian
On 05/03/2007, at 9:24 PM, Sam Barnum wrote:
I usually put a hidden submit button at the top of the form which
doesn't do anything.
<input type="submit" style="visibility:hidden;width:1px;height:
1px;"/>
Then any [enter] presses just submit the form and remain on the
main page. This can actually come in handy if there's some
dynamically calculated values displayed on the page, like a sum of
all qty fields, or something.
This might be a good approach to use as a fallback with the
javascript mentioned by Ian.
--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952
On Mar 4, 2007, at 4:43 PM, Ian Joyner wrote:
This is what I do. You need to attach a little bit of JavaScript
to all your text fields:
function check_enter (event) {
// Stop user logging out when return or enter pressed.
// We need a better way of attaching them to the + button.
var code = document.layers? event.which: event.keyCode;
if (code == 13 || code == 3) {
document.Video_library.submit ();
return false;
}
return true;
}
Add a binding to the text fields "onKeyPress" to call this
function. (Press + in the top right corner of the text field
inspector).
new_playlist_name: WOTextField {
value = session.playlists.new_playlist_name;
onKeyPress = "return check_enter (event)";
}
In check_enter above, I wanted the form to be submitted, but it
stopped the submit going to the first button (which happened to
be log out). So you want to transform the above into returning a
tab to next field (I don't know if that will actually work), but
at least you can get rid of responses to crs and enters.
Ian
On 04/03/2007, at 10:26 AM, Baiss Eric Magnusson wrote:
I watched, a bit aghast, as a Windows user was on my Mac and
constantly hitting the <return> key in the middle of form entry.
Well, I don't handle that situation well at times, and, well
what does one do to trap, or better yet, to disable the return
key from doing a <submit> of the form.
I see that the Return key is going to the first <WOImageButton>
on the Form, which at times would be ok, at others not. Should I
allow the Return key to do a <submit>? And if so, how do I tell
it in the <WOImageButton> action method to do the <changeEdit>
method instead of the method that it would do if clicked on?
----
Baiss Eric Magnusson
<http://www.Track-Your-Finances.com>
<http://www.CascadeWebDesign.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden