wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes HTML Submit Button.....URGENT...PLEASE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML Submit Button.....URGENT...PLEASE" Watch "HTML Submit Button.....URGENT...PLEASE" New topic
Author

HTML Submit Button.....URGENT...PLEASE

Sam Pat
Greenhorn

Joined: Feb 20, 2003
Posts: 9
Hi,
I have an Application Entry system that is written in html + java script and java servlets...
I have Textbox and html submit button on the Screen. While i am in process of filling the
information in textbox, if i hit the Enter key it goes to next screen. So it triggers the ENTER KEY.
Is there a way that the enter key would only start the screen process if the next button was in focus..
Any help would be greatly appreciated...
I am attaching the html code for the screen and function from java script file...
Again Thanks.
============================================================
HTML CODE
+=++++++++++++
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<HTML>
<HEAD>
<META name='GENERATOR' content='IBM WebSphere Studio'>
<META http-equiv='Content-Style-Type' content='text/css'>
<SCRIPT language='JAVASCRIPT' type='text/javascript' src='/AppEntryBC1Web/jscript/AEForm.js'></SCRIPT>
<LINK rel='stylesheet' type='text/css' href='/AppEntryBC1Web/css/AppEntry.css'>
<TITLE>Application Entry System-Client Search</TITLE>
</HEAD>
<BODY class='HTMLPage'>
<DIV class='HTMLPage-title-background'>
</DIV>
<SPAN class='HTMLPage-system'>Application Entry System</SPAN>
<SPAN class='HTMLPage-title'>Client Search - Policy Number: AB10004290 -<NOBR> Client Name: K JAN (0892324781)</NOBR></SPAN>
<DIV class='HTMLPage-menubar-container'>
<DIV class='HTMLPage-menubar-item'></DIV>
</DIV>
<DIV class='HTMLPage-body'>
<DIV id='HTMLErrorTable' style='' class='HTMLPage-div'>
</DIV>
<FORM METHOD="POST" ACTION="/AppEntryBC1Web/AEServlet?user=PWDH&pol_num=AB12f03190&form=ClientSearchForm" NAME="HTMLForm"><TABLE class='HTMLTable'>
<TR class='HTMLTableRow'><TD class='HTMLTableData'>Company Name:</TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="CompanyName" type="TEXT" size="25" maxlength="25" value="">
</TD>
</TR>
</TABLE>
<BR> OR <BR><TABLE class='HTMLTable'>
<TR class='HTMLTableRow'><TD class='HTMLTableData'>Last Name:</TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="LastName" type="TEXT" size="25" maxlength="25" value="JON"></TD>
<TD class='HTMLTableData'>First Name:</TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="FirstName" type="TEXT" size="25" maxlength="25" value="K"></TD>
</TR>
<TR class='HTMLTableRow'><TD class='HTMLTableData'>Social Security Number:</TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="SSN" type="TEXT" size="25" maxlength="25" value="22364444"></TD>
<TD class='HTMLTableData'>Date Of Birth:</TD><TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="DateOfBirth" type="TEXT" size="25" maxlength="25" value="1936-10-10" onblur='if (!isDate(this.value)) displayErrMsg("Invalid date")'></TD>
</TR>
<TR class='HTMLTableRow' id='hiddenRow' style='display: none;'><TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="InsuredType" type="HIDDEN" size="25" maxlength="25" value="INSURED" onblur='if (!isDate(this.value)) displayErrMsg("Invalid date")'></TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="tCancel" type="HIDDEN" size="25" maxlength="25" value="Cancel" onblur='if (!isDate(this.value)) displayErrMsg("Invalid date")'></TD>
<TD class='HTMLTableData'><INPUT class='HTMLTextBox' name="hBlankId" type="HIDDEN" size="25" maxlength="25" value="" onblur='if (!isDate(this.value)) displayErrMsg("Invalid date")'></TD>
<TD class='HTMLTableData'>
</TD>
</TR>
</TABLE>
</FORM>
</DIV>
</BODY>
</HTML>
======================================================================
Here's Java Script code....
++++++++++++++++++++++++++
///////////////////////////////////////////////////////////////////////////////////
/**
* HTMLSubmitButton Javascript.
*
* The following script is used to prevent a user from re-submitting an HTML form
* to the server.
*
*/
function preventReSubmit(theSubmitButton) {
var SUBMIT_VALUE = "Processing request, please wait...";
if (theSubmitButton.value==SUBMIT_VALUE){
// Cancel the submittion...
theSubmitButton.form.onsubmit=function(){return false};
}else{
// Request patience...
theSubmitButton.value=SUBMIT_VALUE;
}
}
/**
* End of HTMLSubFormButton and HTMLReturnSelectionButton javascript.
*/
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
try in your form tag to put this:
<Form onSubmit="return false"
see if that does the trick
[ February 20, 2003: Message edited by: Eric Pascarello ]
Sam Pat
Greenhorn

Joined: Feb 20, 2003
Posts: 9
Hi Eric,
Thank you for your reply...
I am kind of new to this...
Can you please show me a simple example...
Again Thanks.
Originally posted by Eric Pascarello:
try in your form tag to put this:
<Form onSubmit="return false"
see if that does the trick
[ February 20, 2003: Message edited by: Eric Pascarello ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
<Form onSubmit="return false"

change this:
<FORM METHOD="POST" ACTION="/AppEntryBC1Web/AEServlet?user=PWDH&pol_num=AB12f03190&form=ClientSearchForm" NAME="HTMLForm">
to
<FORM METHOD="POST" onSubmit="return false" ACTION="/AppEntryBC1Web/AEServlet?user=PWDH&pol_num=AB12f03190&form=ClientSearchForm" NAME="HTMLForm">
I think this will do the trick......
 
Don't get me started about those stupid light bulbs.
 
subject: HTML Submit Button.....URGENT...PLEASE
 
Similar Threads
Check box (if checks) validation on text field
javascript error: object expected
jQuery not working on page
Struts IE render problem
Dynamic Input fields when a drop down value is selected