Solved

Form error on text box.

Posted on 2000-04-04
2
164 Views
Last Modified: 2010-04-09
I have an html form that asks the user to input one line of text into a text  box then press "submit". My problem is if the user enters the text then hits return an error pops up

"HTTP Error 404
404 not found
The web server cannot find the file..."

What code can I put into the form to either submit the form upon the user hitting the return key or does nothing until the user selects the submit button?

My current code is:

<form name="TextForm" onSubmit="location.href='../../_derived/nortbots.htm';return false;" action="../../_derived/nortbots.htm" method="POST" webbot-action="--WEBBOT-SELF--" WEBBOT-onSubmit="setVars();return false;">
 Owner Name:&nbsp;&nbsp;&nbsp;<BR><INPUT
name=owner size=17 value=Smith>&nbsp;&nbsp;
</form>
<FORM name=TextForm onsubmit="setVars();return false;">
  <input type="submit" value="Submit" name="submit"><br>
  <b>Note:</b><font color="#ff0000" size="-1">Enter the Owner's last name (or the first few letters). A list of potential matches will be displayed.</font> </FORM>

0
Comment
Question by:apwbe
  • 2
2 Comments
 
LVL 8

Expert Comment

by:jbirk
ID: 2685369
If the onsubmit event is return false then the form shouldn't get submitted even when the user presses submit.  It will run setVars() whatever that does (no code for that was posted) but not submit it.  As for the automatic return submitting it should be caught by the onSubmit handler.  Do you have  this online somewhere that I can see the complete source?

-Josh
0
 
LVL 8

Accepted Solution

by:
jbirk earned 100 total points
ID: 2685381
I had another thought.  You have onSubmit for the first form performing a location change. onSubmit="location.href='../../_derived/nortbots.htm';return false;"  That is the code that is probably getting executed when enter is pressed (hence a 404 file not found error).  Change it to:onsubmit="setVars();return false;" from the second form.
-Josh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Fixing my modal from bootstrap 18 39
Bootstrap more than 12 columns in row 3 36
html form to write data to csv 24 95
How to avoid jquery conflicts in Wordpress ? 4 23
Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now