Validating Number Very Urgent

Ads
 

Validating Number Very Urgent

View Answers

August 11, 2008 at 3:15 PM

wat do u want to check?
if u want to insert number only in the emp id field...then u can u use this...
<%@ page language="java" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.*" %>

<HTML>
<BODY BGCOLOR="LIGHTYELLOW">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Employee","","");
Statement stmt=null;
%>
<FORM NAME="form"




onSubmit="return checkban()"





METHOD="GET" ACTION="process.jsp">



<script language="javascript">
function Validate() {





var anum=/(^\d+$)|(^\d+\.\d+$)/
if (anum.test(phone))
return true
else{
alert("Please input valid emp no!")
return false
}






if(form.id.value=="") {
alert("Employee ID cannot be null");
form.id.focus();
return false;
}
if(form.name.value=="") {
alert("Employee Name cannot be null");
form.name.focus();
return false;
}
return true;
}
function Valid() {
if(form.id.value=="") {
alert("Employee ID cannot be null");
form.id.focus();
return false;
}
return true;
}
function check() {
if(form.id.value=="") {
alert("Employee ID cannot be null");
form.id.focus();
return false;
}
if(form.nname.value=="") {
alert("Please Enter a name to be modified");
form.nname.focus();
return false;
}
return true;
}
</script>








<script>
function checkban(){
if (document.layers||document.all||document.getElementById)
return Validate()
else
return true
}
</script>







<H3> <P ALIGN="CENTER"> <FONT SIZE=6> EMPLOYEE DETAILS </FONT> </P> </H3> </BR> </BR>
<BR>
<BR>
<TABLE CELLSPACING=5 CELLPADDING=5 BGCOLOR="LIGHTBLUE" COLSPAN=2 ROWSPAN=2 ALIGN="CENTER">
<TR>
<TD> <FONT SIZE=5> Enter Employee ID </TD> <TD> <INPUT TYPE="TEXT" NAME="id" id="emp_id" value=""> </TD> <TD> <INPUT TYPE="BUTTON" VALUE="View Database" onClick="window.open('Database.jsp','mywindow','width=500,height=350,toolbar=no,resizable=no,scrollbars=1')">
</FONT> </TD>
</TR>
<TR>
<TD> <FONT SIZE=5> Enter Employee Name </TD>
<TD><INPUT TYPE="TEXT" NAME="name" id="emp_name" value="">
</FONT> </TD>
</TR>
<TR>
<TD> <FONT SIZE=5> Enter New Name (For UPDATE only) </TD>
<TD><INPUT TYPE="TEXT" NAME="nname"> </FONT> </TD>
</FONT> </TR>
<TR> <FONT SIZE=6>







<TD> <INPUT TYPE="SUBMIT" NAME="s1" VALUE="Insert" >
<INPUT TYPE="SUBMIT" NAME="s1" VALUE="Delete" >
<INPUT TYPE="SUBMIT" NAME="s1" VALUE="Update" >








<INPUT TYPE="RESET" NAME="re" VALUE="Reset"> </TD>
</TR> </FONT>

<%
if(session.getAttribute("empcode") !=null && session.getAttribute("empname") !=null) { %>
<script language="javascript">
document.getElementById('id').value=<%=session.getAttribute("empcode").toString()%>
document.getElementById('name').value='<%=session.getAttribute("empname").toString()%>'
</script>
<%
session.removeAttribute("empcode");
session.removeAttribute("empname");
}

%>
</FORM>
</BODY>
</HTML>





I have added some code and made some changes....whereevr i made changes i hav inserted linebreaks...

hope it solve the problem,....


thanks and regards
prashu

Ads









Related Tutorials/Questions & Answers:
very urgent
very urgent  ** how to integrate struts1.3 ,ejb3,mysql5.0 in jboss server with myeclipse IDE
its very urgent please help me
its very urgent please help me  how can i retrieve all images from ms access database and display in jsp pages
Advertisements
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
very urgent, want to submit my project on monday
very urgent, want to submit my project on monday  i have the code for connected combo-boxes(jsp). But the thing i want to know is, how to access the values selected in those combo-boxes, for storing in database. in the case
plz help -java project very urgent
plz help -java project very urgent  ? Ford furniture is a local... the furniture ordered by the total number of sales with the following info: name, id, total number of sales, total sales, total original price Step 3: Generate a report
Very urgent Image Selection - JSP-Servlet
Very urgent Image Selection  Respected Sir/Madam, I am R.Ragavendran.. If you are telling that your coding works fine, then can u plz tell me or send me the output of the following code asap? var imageURL
Urgent
J2ME programming  Hi, J2ME programming - How to learn J2ME Programming very fast? Thank You
Validating XML
Validating XML  Hi, I have a string containing data in XML format. I have to Validate this xml data. Is there any method in java that allows strings as input to validate xml?   Please visit the following link: http
urgent need
urgent need   Input a line. Count the number of words that start with a capital letter
validating web pages
validating web pages  How to validate HTML web pages
Validating image size
Validating image size  How to validate image size to 2MB in javascript which is updating to mysql database
Urgent requirement
Urgent requirement  I want to implement Autocompletion code for Jcombobox in swing can you please help me out from
validating email id
validating email id  how to validate the email id ?   <html> <script> function validate(){ var e=document.getElementById('email').value; var regExpObj = /(\d\d\d)-\d\d\d\d\d\d\d\d/; var reg
Validating the password field
Validating the password field  When the validate method returns back to the registration page the password field get cleared there by asking again one more time to enter the password field at the time of re-submitting the form
PLease reply its urgent
PLease reply its urgent   Write a java function that has...? That takes a number of hours and minutes (up to several days), and returns the number of times the minute and hour hands of a standard analog clock would cross
MySQL default port number and how to change it
number used by the MySQL Server. This information is very important for you...MySQL default port number and how to change it What is default port number... the port number in your program. You can also change the port number of MySQL
validating username and password from database
validating username and password from database  Hello sir, i am developing a login page. i want that when i fill data in text fields. it validate data from database. if enter data is match from database. page goes to next page
java linked list urgent!!!
java linked list urgent!!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
java linked list urgent !!!
java linked list urgent !!!  Q1. Generate 10 thousand random integers with values in the range between 1 to 100. Q2. Store each randomly generated number into a node and then attach the node to a linked list. The list must
ModuleNotFoundError: No module named 'urgent'
ModuleNotFoundError: No module named 'urgent'  Hi, My Python... 'urgent' How to remove the ModuleNotFoundError: No module named 'urgent'... to install padas library. You can install urgent python with following command
very important - Kindly help
very important - Kindly help   I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e Download the PDf File from the Database ) , when the user gives the Application number
Urgent java programming question.Pls help
Urgent java programming question.Pls help  Q1. Generate 10 thousand... randomly generated number into a node and then attach the node to a linked list... Number 1 - 100"); for (int nbr = 1; nbr < 11; nbr++) { rndNumber
urgent please, help!
urgent please, help!  how to make jTable unclickable and have unmovable columns, thanks in advance   import javax.swing.*; import java.awt.*; public class SimpleJTableExample{ public static void main(String[] args
Binary search tree (insertion) urgent!!
Binary search tree (insertion) urgent!!  Create a program... Generate random values between zero and twice the number of values to add... to create a tree containing up to the number of nodes indicated by a command line
Need the program urgent veryyyyyyyyyyyyy urgent plsssssssssssssssssss follow the standard in the program
Need the program urgent very urgent please follow the standard in the program  Restaurant Order Management System (ROMS) Problem Case: Create a ROMS system, which is intended to take an order from the customer and charge
Urgent programming assignment
Urgent programming assignment   Hi, I am an Indian student in USA.I have been able to write all the java codes successfully , however this one is giving me tremors.Any help would be highly appreciated.I am attaching

Ads