js

js

View Answers

October 16, 2008 at 12:32 PM

hai frnd........


<script language="JavaScript1.2">
function checknumber(){
var cont=document.form.txtNAMEOFCONT.value
var conlabeng=document.form.txtNAMEOFCONLABENG.value
var anum=/(^\d+$)|(^\d+\.\d+$)/

testresult=true

if(cont=="")
{
alert("Please type your cont!")
testresult=false
}

if(conlabeng=="")
{
alert("Please type your conlabeng!")
testresult=false
}

return (testresult)
}

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

change the form tag to <form name="form" onSubmit="return checkban()" action="your page" method="post">



this is the javascript to check the text box is null.......

thanks and regards
prashu
[email protected]


October 16, 2008 at 1:02 PM

Hi Ragini,

<html>
<title>character validation in jsp</title>
<head>

<script type="text/javascript">

var digits = "0123456789";

var phoneNumberDelimiters = "()- ";

var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s){

var i;
for (i = 0; i < s.length; i++)
{
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function trim(s)
{ var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not a whitespace, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (c != " ") returnString += c;
}
return returnString;
}
function stripCharsInBag(s, bag){
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}

function checkInternationalPhone(strPhone){
var bracket = 3;
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1)
return false;
if(strPhone.indexOf("-")!=-1)bracket=bracket+1;
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)
return false;
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")
return false;
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)
return false;
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function isProper(string) {

if (!string) return false;
var iChars = "*|,\":<>[]{}`\';()@&$#%";

for (var i = 0; i < string.length; i++) {
if (iChars.indexOf(string.charAt(i)) != -1)
return false;
}
return true;
}

October 16, 2008 at 1:03 PM

function validateForm(theForm){


if(theForm.username.value==""){
//Please enter username
alert("Enter the First Name.");
theForm.username.focus();
return false;
}

if (isProper(theForm.username.value) == false) {
alert("Please enter a valid First Name.");
theForm.username.focus();
return false;
}

if(theForm.username.value.length > 20) {
alert("Maximum 20 characters allowed for 'First Name'.")
theForm.username.focus() ;
return false;
}


if(theForm.address.value==""){
//Please enter address
alert("Enter the Address.");
theForm.address.focus();
return false;
}

if (isProper(theForm.address.value) == false) {
alert("Please enter a valid address.");
theForm.address.focus();
return false;
}

if(theForm.address.value.length > 50) {
alert("Maximum 50 characters allowed for 'address'.")
theForm.address.focus() ;
return false;
}

var Phone=document.frmSample.txtPhone;

if ((Phone.value==null)||(Phone.value=="")){
alert("Please Enter your Phone Number");
Phone.focus();
return false;
}
if (checkInternationalPhone(Phone.value)==false){
alert("Please Enter a Valid Phone Number");
Phone.value="";
Phone.focus();
return false;
}

return true;
}
</script>
</head>

October 16, 2008 at 1:03 PM

<body>
<br><br><br><br>
<center>
<table border="1" width="50%" bgcolor="lightpink" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form name="frmSample" method="POST" action="" onsubmit="return validateForm(this);">

<h2 align="center">Validation Form</h2>
<table border="1" width="100%" cellspacing="0" cellpadding="0">

<tr>
<td width="50%"><b>User Name:</b></td>
<td width="50%"><input type="text" name="username" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Address:</b></td>
<td width="50%"><input type="text" name="address" size="50"/> </td>
</tr>
<tr>
<td width="50%"><b>Phone Number:</b></td>
<td width="50%"><input type="text" name="txtPhone" size="20"/> </td>
</tr>

</table>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>

</form>
</td>
</tr>
</table>
</center>
</body>
</html>
------------------------------------------------

Visit for more information.

http://www.roseindia.net/jsp/

Thanks.









Related Tutorials/Questions & Answers:
EXT JS
EXT JS   i want to create a grid in extjs to display data from mysql and if i want to edit the data i must update through extjs only and must update in mysql database. please help me with sample code. thank you
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
Advertisements
Lightbox JS
Lightbox JS/font>       Lightbox JS is a simple, unobtrusive script used to overlay images on the current page. It`s a snap to setup and works on all modern browsers. Read full
ModuleNotFoundError: No module named 'js'
ModuleNotFoundError: No module named 'js'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js' How to remove the ModuleNotFoundError: No module named 'js' error
ModuleNotFoundError: No module named 'js'
ModuleNotFoundError: No module named 'js'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js' How to remove the ModuleNotFoundError: No module named 'js' error
Version of rhino>js dependency
List of Version of rhino>js dependency
Version of jaxme>jaxme-js dependency
List of Version of jaxme>jaxme-js dependency
Version of com.belteshazzar>junit-js dependency
List of Version of com.belteshazzar>junit-js dependency
Version of com.butor>butor-js dependency
List of Version of com.butor>butor-js dependency
Version of com.cognitect>transducers-js dependency
List of Version of com.cognitect>transducers-js dependency
Version of com.cognitect>transit-js dependency
List of Version of com.cognitect>transit-js dependency
Version of com.synhaptein>scalator-js dependency
List of Version of com.synhaptein>scalator-js dependency
ModuleNotFoundError: No module named 'dreadnought-js'
ModuleNotFoundError: No module named 'dreadnought-js'  Hi, My... named 'dreadnought-js' How to remove the ModuleNotFoundError: No module named 'dreadnought-js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jinja-to-js'
ModuleNotFoundError: No module named 'jinja-to-js'  Hi, My Python... 'jinja-to-js' How to remove the ModuleNotFoundError: No module named 'jinja-to-js' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'js-generator'
ModuleNotFoundError: No module named 'js-generator'  Hi, My Python... 'js-generator' How to remove the ModuleNotFoundError: No module named 'js-generator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'js_nester'
ModuleNotFoundError: No module named 'js_nester'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js_nester' How to remove the ModuleNotFoundError: No module named 'js
ModuleNotFoundError: No module named 'js-object'
ModuleNotFoundError: No module named 'js-object'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js-object' How to remove the ModuleNotFoundError: No module named 'js
ModuleNotFoundError: No module named 'leap.bitmask_js'
ModuleNotFoundError: No module named 'leap.bitmask_js'  Hi, My... named 'leap.bitmask_js' How to remove the ModuleNotFoundError: No module named 'leap.bitmask_js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'leap.bitmask_js'
ModuleNotFoundError: No module named 'leap.bitmask_js'  Hi, My... named 'leap.bitmask_js' How to remove the ModuleNotFoundError: No module named 'leap.bitmask_js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'miyadaiku.themes.popper-js'
ModuleNotFoundError: No module named 'miyadaiku.themes.popper-js'  Hi...: No module named 'miyadaiku.themes.popper-js' How to remove the ModuleNotFoundError: No module named 'miyadaiku.themes.popper-js' error? Thanks
ModuleNotFoundError: No module named 'oc-js'
ModuleNotFoundError: No module named 'oc-js'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'oc-js' How to remove the ModuleNotFoundError: No module named 'oc-js'
ModuleNotFoundError: No module named 'oc-js'
ModuleNotFoundError: No module named 'oc-js'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'oc-js' How to remove the ModuleNotFoundError: No module named 'oc-js'
ModuleNotFoundError: No module named 'pybillboard-js'
ModuleNotFoundError: No module named 'pybillboard-js'  Hi, My... named 'pybillboard-js' How to remove the ModuleNotFoundError: No module named 'pybillboard-js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'py_js'
ModuleNotFoundError: No module named 'py_js'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'py_js' How to remove the ModuleNotFoundError: No module named 'py_js'
ModuleNotFoundError: No module named 'pyramid-js'
ModuleNotFoundError: No module named 'pyramid-js'  Hi, My Python... 'pyramid-js' How to remove the ModuleNotFoundError: No module named 'pyramid-js' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'sphinx-js'
ModuleNotFoundError: No module named 'sphinx-js'  Hi, My Python... 'sphinx-js' How to remove the ModuleNotFoundError: No module named 'sphinx-js' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'bypass-js'
ModuleNotFoundError: No module named 'bypass-js'  Hi, My Python... 'bypass-js' How to remove the ModuleNotFoundError: No module named 'bypass-js' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'dreadnought-js'
ModuleNotFoundError: No module named 'dreadnought-js'  Hi, My... named 'dreadnought-js' How to remove the ModuleNotFoundError: No module named 'dreadnought-js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'is-minified-js'
ModuleNotFoundError: No module named 'is-minified-js'  Hi, My... named 'is-minified-js' How to remove the ModuleNotFoundError: No module named 'is-minified-js' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jinja-to-js'
ModuleNotFoundError: No module named 'jinja-to-js'  Hi, My Python... 'jinja-to-js' How to remove the ModuleNotFoundError: No module named 'jinja-to-js' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'js-django-bootstrap31'
ModuleNotFoundError: No module named 'js-django-bootstrap31'  Hi...: No module named 'js-django-bootstrap31' How to remove the ModuleNotFoundError: No module named 'js-django-bootstrap31' error? Thanks   Hi
ModuleNotFoundError: No module named 'js-generator'
ModuleNotFoundError: No module named 'js-generator'  Hi, My Python... 'js-generator' How to remove the ModuleNotFoundError: No module named 'js-generator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'js-host'
ModuleNotFoundError: No module named 'js-host'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js-host' How to remove the ModuleNotFoundError: No module named 'js-host
ModuleNotFoundError: No module named 'js-invoke'
ModuleNotFoundError: No module named 'js-invoke'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js-invoke' How to remove the ModuleNotFoundError: No module named 'js
ModuleNotFoundError: No module named 'js_nester'
ModuleNotFoundError: No module named 'js_nester'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js_nester' How to remove the ModuleNotFoundError: No module named 'js
ModuleNotFoundError: No module named 'js-object'
ModuleNotFoundError: No module named 'js-object'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js-object' How to remove the ModuleNotFoundError: No module named 'js
ModuleNotFoundError: No module named 'js_project'
ModuleNotFoundError: No module named 'js_project'  Hi, My Python... 'js_project' How to remove the ModuleNotFoundError: No module named 'js... have to install padas library. You can install js_project python
ModuleNotFoundError: No module named 'js-regex'
ModuleNotFoundError: No module named 'js-regex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'js-regex' How to remove the ModuleNotFoundError: No module named 'js-regex
tensorflow js course
tensorflow js course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: tensorflow js... the topic "tensorflow js course". Also tell me which is the good training
tensorflow js udemy
tensorflow js udemy  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: tensorflow js udemy... the topic "tensorflow js udemy". Also tell me which is the good training
tensorflow js training
tensorflow js training  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: tensorflow js... the topic "tensorflow js training". Also tell me which is the good
js,,mysql - JSP-Servlet
js,,mysql  Hi, I want a jsp code for editing,deleting data retrieved from from the mysql database and displayed in a html page .Can anybody provide me a code for including edit and delete options with the following code
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.570 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.570 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.570 of kotlin-js-js... 1.0.0-pre.570 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.603 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.603 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.603 of kotlin-js-js... 1.0.0-pre.603 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.630 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.630 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.630 of kotlin-js-js... 1.0.0-pre.630 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.666 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.666 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.666 of kotlin-js-js... 1.0.0-pre.666 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.501 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.501 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.501 of kotlin-js-js... 1.0.0-pre.501 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
org.jetbrains.kotlin-wrappers - kotlin-js-js version 1.0.0-pre.597 Maven dependency. How to use kotlin-js-js version 1.0.0-pre.597 in pom.xml?
org.jetbrains.kotlin-wrappers  - Version 1.0.0-pre.597 of kotlin-js-js... 1.0.0-pre.597 of kotlin-js-js in pom.xml? How to use kotlin-js-js version... of kotlin-js-js in project by the help of adding the dependency in the pom.xml file
Configure Js request in Web.xml
Configure Js request in Web.xml  Hi all, I have 1 basic doubt,suppose i have 2 jsp,1 servlet,1 web.xml file.i need to redirect 1 page via servlet with help of web.xml file.Here just i need to redirect to mainCtrl.java
Help for website development on Angular JS
Help for website development on Angular JS  want to develop a website using angular JS. I am new to the platform or coding on angular JS. Can i update a database column and get that data uploaded on my webpage simultaneosuly

Ads