473,320 Members | 2,122 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,320 software developers and data experts.

single text field, submission with ENTER or TAB

Because this is a form with a single text field, I require submition
when ENTER OR TAB is pressed in the text box). However since their is
only one field I can't use tab. Nor for some reason can I use enter.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>third page</title>
<script type="text/javascript">
<!--
function changeEvent(){
alert("stuff");
document.close()
}
//-->
</script>
</head>

<body>
<form onsubmit="return false">
Enter text to be copied to calling page
<input type="text" onchange="changeEvent()" value="type something">
</form>
</body>
</html>

Dec 19 '06 #1
3 1839
Rupe wrote on 19 dec 2006 in comp.lang.javascript:
Because this is a form with a single text field, I require submition
when ENTER OR TAB is pressed in the text box). However since their is
only one field I can't use tab. Nor for some reason can I use enter.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>third page</title>
<script type="text/javascript">
<!--
do not use <!--

function changeEvent(){
alert("stuff");
document.close()
}
//-->
do not use //-->
</script>
</head>

<body>
<form onsubmit="return false">
Logically, my dear Watson, submission is effectively switched off by the
above onsubmit!
Enter text to be copied to calling page
<input type="text" onchange="changeEvent()" value="type something">
onchange will only fire on blur, I think.
</form>
</body>
</html>
Try:

<form>
<input
onkeydown = 'if (event.keyCode==9) this.form.submit();'
type="text" name='what' value="give enter or tab">
</form>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 19 '06 #2
i'm not actually wanting to do a submit as such, i'm only wanting to
update the main page data via opening a second page, placing details in
that second page then returning to the main page.

further, I was trying not to use window.open() rather just change the
location.href value. unfortunately just doing this on returning to the
main page, the second page's details remains in the browser. id running
window.document.title after returning to the main page returns the
title of the second page.

perhaps there a page naviagation tutorial online you recommend. as the
only way seems to be to open a second tab/window and then close it
after. I was just hoping to flick documents within the same tab.

Dec 19 '06 #3
Rupe wrote on 19 dec 2006 in comp.lang.javascript:
i'm not actually wanting to do a submit as such,
What are you talking about???????

[please always quote on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 19 '06 #4

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

Similar topics

1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
3
by: Mark | last post by:
Hi, Im trying to validate a form, all the validating works apart from one field. This particular field must consist of the first 2 characters as letters, & the following 5 as numbers. And if it...
3
by: Solution Seeker | last post by:
I want to Store the String value with Single Quotes in the Field of Database where if i try to Store the String value with Single Quotes (as it is) then it is throwing the error as SQL String...
0
by: lucietee | last post by:
Hi, hope someone might be able to help. I have an ASP based portal site with about 15 users - it has a photo gallery section which allows users to submit their own pictures to the gallery. The...
8
by: Gianni Rondinini | last post by:
hi all. i've almost finished moving all the tags from html to my css. however, i can't find a way (if there's one) to move the property maxlength of an <input type=text ...tag to the css in...
4
by: Vikas Kumar | last post by:
propertyDescription += "<br>" + lblpropertyDescription.Text; //here i am reading some text from text area i test wrting "p" in my text area it wrks fine but when i write <pin my text...
1
by: hotrod57 | last post by:
I am trying to append the results from a form to a text file. My code is supposed to print out the results on one page, and append the results to another page each time data is entered on the form...
3
by: smokinlabbit | last post by:
I'm trying to come up with a solution (but with no real direction to start with) where I'm trying to edit data in a td element of a table on the spot. What I want to do is when a td element...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.