Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit button

Status
Not open for further replies.

Oxymoron

Technical User
Dec 17, 2000
168
GB
Hi, I have made an inputbox for a form, which has a small level of VBScript (which isn't important in this question) but I can only get the operation I want, If I click the button next to it (which is what I have designed it to do). But If I press 'enter' after I have inputed a value. It simply refreshes to a blank input box. Is there anyway I can set an onClick, or onKeypress (specifically for the 'Enter' button-else if the onKeypress code is entered, I can't write anything in there!!)
PLEASE help, any solutions welcome VBScript, HTML, whatever!
JOE
joewardell@hotmail.com
 
I assume you are developing for IE only, if you are using VBScript. IF you don't need to actually submit the form anywhere, jsut take the text box and button out of the form tags, get rid of them - it's probably submitting the form and reloading the page and that's why the box is coming up blank. jared@aauser.com
 
"the button next to it" has to be a submit button to auto submit when one presses enter
to set an onclick or onkeypress or whichever event, simply do <input type=... onclick=&quot;your_function()&quot;>
the function to submit a form is submit()
i'm not sure if it helps enough ... if not please tell me


 
Hi me again.
Thanx for the reply, but it's not really what was troubling me.
for example, when u search for something in yahoo, you enter your criteria. Then you either click the search button, OR you just press the enter button on the Keyboard. I'd like to know how you can set a process for this in HTML, onKeypress_(enter) I know that ISN'T is, but if you know something like that, could you let me know. Thanks
and thankyou 'jaredn' for the tip anyway!
JOE
 
don't think you can capture the enter key - but if you put the textfield inside a form and make the button <input type=submit> pressing enter should automatically submit the form. then you could place the code you want in the action fo your form and display the result hwoever you want jared@aauser.com
 
Thanks, the last 2 replies, look like they shoukd work. Cheers both of you, this is a great forum site!
I'll let you know how the tips go.
Thanx y'all.
JOE
(more replies still welcome!!!)
 
From
Keyboard events occur when the user presses or releases a keyboard key. The onkeydown and onkeyup events fire when a key changes state as it pressed or released, respectively. These events fire for all keys on the keyboard, including shift state keys such as SHIFT, CTRL, and ALT.

The onkeypress event fires when the user's keyboard input is translated to a character. These occur, for example, when the user presses letter or number keys, or a combination of shift keys and letters and numbers.

When a keyboard event occurs, the keyCode property of the event object contains the Unicode™ keycode of the corresponding key. The altKey, ctrlKey, and shiftKey properties specify the state of the ALT, CTRL, and SHIFT keys.

You can change which key is associated with the event by either changing the value of the keyCode property or returning an integer value. You can cancel the event by returning zero or false.

The onhelp event is a special keyboard event that occurs when the user presses the help key (F1).

Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
there was also a thread almost on the same subject a few days ago ...
let us know !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top