473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Input, Buttons and Enter Keys

Hello,
Can someone lead me in the right direct with this request:
Please look at the piece of code below:

<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
>
<input type="text" id="newSong" />
</td>
</tr></table>

As you can see, an input box is opened and when the user enters his
search phrase AND CLICKS THE BUTTON, the javascript contained in
justSong_filter() does its thing, etc., etc.
All works fine.

What I'd like, however, is to have NO BUTTON at all. None. What I want
to happen is that the user enters his search phrase and then have him
HIT THE ENTER KEY on the keyboard to initiate the javascript, as
occurs in the original code above.

Currently, after the user enters his search phrase, hitting the Enter
Key does nothing at all. He must click on the Button.

Can someone show me how to re-code the above activity to perform as it
currently does, but to have no button and using the Enter Key as the
final firing sequence?

I thought it would be pretty straight forward - seems I am wrong!
I've messed with this for about 3 days and I've gotten nowhere, so I
must be looking/thinking in the wrong place.

Any help, as always, would be greatly appreciated.
Regards.
Mar 25 '08 #1
6 1821
Omicron wrote:
Can someone lead me in the right direct with this request:
Please look at the piece of code below:

<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /

<input type="text" id="newSong" />
</td>
</tr></table>

As you can see, an input box is opened and when the user enters his
search phrase AND CLICKS THE BUTTON, the javascript contained in
justSong_filter() does its thing, etc., etc.
All works fine.

What I'd like, however, is to have NO BUTTON at all. None. What I want
to happen is that the user enters his search phrase and then have him
HIT THE ENTER KEY on the keyboard to initiate the javascript, as
occurs in the original code above.

Currently, after the user enters his search phrase, hitting the Enter
Key does nothing at all. He must click on the Button.

Can someone show me how to re-code the above activity to perform as it
currently does, but to have no button and using the Enter Key as the
final firing sequence?

I thought it would be pretty straight forward - seems I am wrong!
I've messed with this for about 3 days and I've gotten nowhere, so I
must be looking/thinking in the wrong place.
<input type="text" onKeyPress="
var key;
if (window.event)
key = window.event.keyCode;
else if (event)
key = event.which;
if (key == 10 || key == 13)
alert('You have hit Enter!');
">

Cheers,

--
Bart
Mar 25 '08 #2
Omicron wrote:
Can someone lead me in the right direct with this request:
Please look at the piece of code below:

<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
<input type="text" id="newSong" />
</td>
</tr></table>
Avoid XHTML on the Web, IE does not even support it. Your markup is not
Valid XHTML and it does not make sense anyway (a one-row one-column table?).
[...]
What I'd like, however, is to have NO BUTTON at all. None. What I want
to happen is that the user enters his search phrase and then have him
HIT THE ENTER KEY on the keyboard to initiate the javascript, as
occurs in the original code above.
[...]
Can someone show me how to re-code the above activity to perform as it
currently does, but to have no button and using the Enter Key as the
final firing sequence?
<form action="server_side_script" onsubmit="return justSong_filter(this)">
<fieldset>
<legend>Song Filter</legend>
<input name="newSong">
<input type="submit" value="Apply">
</fieldset>
</form>

justSong_filter() must return `false' if filtering was successful, `true'
otherwise. However, you will need that submit button so that it also works
without client-side script support; you may use type="image" or style it
with CSS.

Please do not SHOUT, see http://rfc-editor.org/rfc/rfc1855.txt
F'up2 cljs because this is not JScript-specific

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Mar 25 '08 #3
SAM
Omicron a écrit :
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
<input type="text" id="newSong" />
</td>

What I'd like, however, is to have NO BUTTON at all. None. What I want
to happen is that the user enters his search phrase and then have him
HIT THE ENTER KEY on the keyboard to initiate the javascript, as
occurs in the original code above.

<form action="#" onsubmit="justSong_filter();return false;">
Choice :<input type="text" id="newSong" />
</form>

Works since NC3 (if there is only one text-field)
modern browsers work same way but with bigger forms
Can also try :

<input type="text" id="newSong"
onkeyup="var e=null; if(typeof event =='object') e=event;
if(event.keyCode == 13) justSong_filter();
return false;" />
--
sm
Mar 25 '08 #4
On Mar 25, 6:10 am, Bart Van der Donck <b...@nijlen.comwrote:
Omicron wrote:
Can someone lead me in the right direct with this request:
Please look at the piece of code below:
<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
<input type="text" id="newSong" />
</td>
</tr></table>
As you can see, an input box is opened and when the user enters his
search phrase AND CLICKS THE BUTTON, the javascript contained in
justSong_filter() does its thing, etc., etc.
All works fine.
What I'd like, however, is to have NO BUTTON at all. None. What I want
to happen is that the user enters his search phrase and then have him
HIT THEENTERKEYon the keyboard to initiate the javascript, as
occurs in the original code above.
Currently, after the user enters his search phrase, hitting theEnter
Keydoes nothing at all. He must click on the Button.
Can someone show me how to re-code the above activity to perform as it
currently does, but to have no button and using theEnterKeyas the
final firing sequence?
I thought it would be pretty straight forward - seems I am wrong!
I've messed with this for about 3 days and I've gotten nowhere, so I
must be looking/thinking in the wrong place.

<input type="text" onKeyPress="
varkey;
if (window.event)
key= window.event.keyCode;
else if (event)
key= event.which;
if (key== 10 ||key== 13)
alert('You have hitEnter!');
">

Cheers,

--
Bart
Thanks to Sam and Bart and (I guess) Thomas, even though I didn't
really understand a word of what Thomas was trying to tell me, other
than I was shouting and in the wrong group (I think).
Anyway, Thanks to all.
Unfortunately, none of the suggestions, at least in the manner I have
tried to implement them, have worked for me.
When I try all the suggestions, essentially one of two things occurs:
Either nothing happens when I press the Return Key, or I get a crash
that buries my TopStyle editor.
If any of you kind folks would like to see if you can get further
into my apparently thick skull, I'd appreciate any additional
comments, leads, references or code you'd like to take the time to
write.
Regards.
Mar 26 '08 #5
SAM
Omicron a écrit :
On Mar 25, 6:10 am, Bart Van der Donck <b...@nijlen.comwrote:
>Omicron wrote:
>>Can someone lead me in the right direct with this request:
Please look at the piece of code below:
<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
<input type="text" id="newSong" />
</td>
</tr></table>
As you can see, an input box is opened and when the user enters his
search phrase AND CLICKS THE BUTTON, the javascript contained in
justSong_filter() does its thing, etc., etc.
All works fine.
What I'd like, however, is to have NO BUTTON at all.
><input type="text" onKeyPress="
varkey;
if (window.event)
key= window.event.keyCode;
else if (event)
key= event.which;
if (key== 10 ||key== 13)
alert('You have hitEnter!');
">

Thanks to Sam and Bart and (I guess) Thomas,
Unfortunately, none of the suggestions, at least in the manner I have
tried to implement them, have worked for me.
When I try all the suggestions, essentially one of two things occurs:
Either nothing happens when I press the Return Key, or I get a crash
that buries my TopStyle editor.
What does an editor has to do here activating JavaScript ?
You must try in a navigator the given codes inserted in a web page.
If any of you kind folks would like to see if you can get further
into my apparently thick skull, I'd appreciate any additional
comments, leads, references or code you'd like to take the time to
write.
Would it be possible to see something working that we could understand
what just-a-song-in-my-bathroom make and how.
references ? Google can gives a lot of them.
mine are in french. Are you interested ?

--
sm
Mar 27 '08 #6
On Mar 26, 8:05 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Omicron a écrit :
On Mar 25, 6:10 am, Bart Van der Donck <b...@nijlen.comwrote:
Omicron wrote:
Can someone lead me in the right direct with this request:
Please look at the piece of code below:
<table summary="Sort Buttons">
<tr>
<td>
<input onclick="justSong_filter()" type="button" value="Song Search" /
<input type="text" id="newSong" />
</td>
</tr></table>
As you can see, an input box is opened and when the user enters his
search phrase AND CLICKS THE BUTTON, the javascript contained in
justSong_filter() does its thing, etc., etc.
All works fine.
What I'd like, however, is to have NO BUTTON at all.
<input type="text" onKeyPress="
varkey;
if (window.event)
key= window.event.keyCode;
else if (event)
key= event.which;
if (key== 10 ||key== 13)
alert('You have hitEnter!');
">
Thanks to Sam and Bart and (I guess) Thomas,
Unfortunately, none of the suggestions, at least in the manner I have
tried to implement them, have worked for me.
When I try all the suggestions, essentially one of two things occurs:
Either nothing happens when I press the ReturnKey, or I get a crash
that buries my TopStyle editor.

What does an editor has to do here activating JavaScript ?
You must try in a navigator the given codes inserted in a web page.
If any of you kind folks would like to see if you can get further
into my apparently thick skull, I'd appreciate any additional
comments, leads, references or code you'd like to take the time to
write.

Would it be possible to see something working that we could understand
what just-a-song-in-my-bathroom make and how.

references ? Google can gives a lot of them.
mine are in french. Are you interested ?

--
sm
Hi Sam,
I use TopStyle editor for coding all my HTML/CSS. It will then load
the code into IE or whatever browser you tell it to for purposes of
testing. All my other JS works via the editor so I don' think that is
relevant to my problem.

You are most welcome to check out the site I'm building for a friend.
Go to:
gtmick.com

Then, from the drop-down menu on the right, pick any of the Music
Databases. Once there, you will see the Search Feature that is in
place, which requires you to enter a search string and then click on
the button. It is here that I'd like to eliminate the button and just
allow the user to hit the Enter Key when ready.

Thanks for your interest.
Regards.
Mar 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: BruceR | last post by:
I have posted a similar message and am reposting due to no response. Basically, I need to know why using the ampersand to indicate an access key for a button makes it so that simply entering the...
0
by: Hiroyuki Tanaka | last post by:
Hi, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to my...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
0
by: bj7lewis | last post by:
I have two modal dlg forms that are invoked(seperately) by a main form but the two modal dlg forms don't close when clicking the OK & Cancel buttons setup as below... Here the setup... //In...
2
by: danielboendergaard | last post by:
Hey Im making a homepage in php. I use a html form to put data into mysql and i want to make some buttons which inserts user input values into a textarea. I have used a button like this: <input...
0
by: stevenhaochen | last post by:
I add a user control (a simple textbox control) to customize datagridview column to test how to add user control to datagridview. I found a weired behavior. I can not input "q", "!", "#". But I...
2
by: NeilCarmichael | last post by:
I am new to writing javascript and am a little confused by all the options to do want Ii want to do so I thought I'd pick your brains. I would like to create somthing like windows default login...
9
by: tigger | last post by:
Hi, I'm using Visual Basic 2005. I'm trying to create shortcut keys for my buttons. Currently, i have 2 buttons, presentButton and plotButton. When i press spacebar, it will perform the...
7
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
Is there any way of getting VS2005 to 'type' the content of a file into the currently open CS file? I am trying to capture the VS2005 screen: I'd like to be able to record the code (already...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.