Hi frnds....

i need Javascript Validations...these validations by using onchange or onblur events..i mean when focus out from a textbox or any field then immediatley shows the error msg and focus will be at error field(not after submitting the form)..i want error immediatley focus out from the field...plz provide 4 or 5 fields, after i can manage...

i am having validations code..but in this way idon't have,basically i am not good in javascript...

plz help me asap..

Thank u...

Recommended Answers

All 6 Replies

Hi frnds....

i need Javascript Validations...these validations by using onchange or onblur events..i mean when focus out from a textbox or any field then immediatley shows the error msg and focus will be at error field(not after submitting the form)..i want error immediatley focus out from the field...plz provide 4 or 5 fields, after i can manage...

i am having validations code..but in this way idon't have,basically i am not good in javascript...

plz help me asap..

Thank u...

Hi reply plz..
If u have any problem with my english plz ask me..
this is urgent for me....i have to complete this today only..

plz reply only for 3 or 4 fields...(when we press tab than immediatly display error beside at the text box or alert box..)

Thank u...

First of all, this question belongs to Javascript forum. Its a javascript related question. 2nd, Post your code and tell us what is not working. We aren't 24/7 free coding service to provide you with ready made code when you say "Please help me asap", or, "Its urgentttt".

Here is some expectablel solution not sure...
for example , if you have a quantity field then , if we entered any letters on that it will show an immediate alert "Please Enter Only Numbers (0-9)"
if this is your expected solution . then the following is the code for that...if not post clearly....

<form name="exampleform" method="post" action="">
<input name="qty" type="text"  id="qty" value="" onKeyUp="Only_Num(this.id)" size="3" maxlength="5">
</form>

function:

function Only_Num(id)
{
 if(isNaN(document.getElementById(id).value))
 {
  alert("Please Enter Only Numbers (0-9)..");
  document.getElementById(id).value='';
  document.getElementById(id).focus();
 }
 return;
}

Here is some expectablel solution not sure...
for example , if you have a quantity field then , if we entered any letters on that it will show an immediate alert "Please Enter Only Numbers (0-9)"
if this is your expected solution . then the following is the code for that...if not post clearly....

<form name="exampleform" method="post" action="">
<input name="qty" type="text"  id="qty" value="" onKeyUp="Only_Num(this.id)" size="3" maxlength="5">
</form>

function:

function Only_Num(id)
{
 if(isNaN(document.getElementById(id).value))
 {
  alert("Please Enter Only Numbers (0-9)..");
  document.getElementById(id).value='';
  document.getElementById(id).focus();
 }
 return;
}

Hi frnds..
Sry for posting this question in php forums...
Thank U shanthi for giving quick reply...
Now i can manage by using this one...

Hi naveen..
i am not asking about readymade code..i need just how to use onchange event ...i am having good validation code, but,that is working only on submitting the total form.....anyhow i am sry 4 distrubing u...

Thank u Naveen..

Ehm.. Okay :confused:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.