473,396 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem in validation

149 100+
hi,
in my project i need to do validation...my form is having some text fields..in that im doing validation...the problem is it is validating for the 'NULL' in one text field and for the another it is not validating....may i know where is the problem..here is my code...

login.js

Expand|Select|Wrap|Line Numbers
  1.  
  2. if (document.frm.localAccNo.value == "")
  3.     {
  4.         alert("Enter Local A/c No. or 'NULL' in capitals");
  5.         document.frm.localAccNo.focus();
  6.         return (false);
  7.     }
  8.     var chkLocalAccNo = document.frm.localAccNo.value;
  9.     //check if it is not a number
  10.     var validation = true;
  11.     if (isNaN(chkLocalAccNo))
  12.     {
  13.         //if it is not a number check if it is NULL
  14.         if (chkLocalAccNo == 'NULL')
  15.         {
  16.             validation = true;
  17.             document.frm.localAccNo.focus();
  18.         }
  19.         else
  20.         {
  21.             validation = false;
  22.             document.frm.localAccNo.focus();
  23.         }
  24.     }
  25.     return validation;    //Close of Local Units Status
  26.  
  27.     if (document.frm.localUnitValid.value == "")
  28.     {
  29.         alert("Enter Local Units Valid");
  30.         document.frm.localUnitValid.focus();
  31.         return (false);
  32.     }//Close of Local Units Valid Status
  33.  
  34.     if (document.frm.localTrnsCode.value == "")
  35.     {
  36.         alert("Enter Local Units Transaction Code");
  37.         document.frm.localTrnsCode.focus();
  38.         return (false);
  39.     }//Close of Local Units Transaction Code Status
  40.  
  41.     if (document.frm.stdAccNo.value == "")
  42.     {
  43.         alert("Enter STD A/c No. or 'NULL' in capitals");
  44.         document.frm.stdAccNo.focus();
  45.         return (false);
  46.     }
  47.     var chkStdAccNo = document.frm.stdAccNo.value;
  48.     //check if it is not a number
  49.     var validation1 = true;
  50.     if (isNaN(chkStdAccNo))
  51.     {
  52.         //if it is not a number check if it is NULL
  53.         if (chkStdAccNo == 'NULL')
  54.         {
  55.             validation1 = true;
  56.             document.frm.stdAccNo.focus();
  57.         }
  58.         else
  59.         {
  60.             validation1 = false;
  61.             document.frm.stdAccNo.focus();
  62.         }
  63.     }
  64.     alert("Validation is :"+validation1);
  65.     return validation1; //Close of STD A/c No. Status
  66.  
  67.     if (document.frm.stdUnits.value == "")
  68.     {
  69.         alert("Enter STD Units");
  70.         document.frm.stdUnits.focus();
  71.         return (false);
  72.     }//Close of STD Units Status
  73.  
  74.  
  75.  
for 'localAccNo' it is validating and for 'stdAccNo' it is not validating...may i know where the code goes wrong
Jul 21 '10 #1
2 1234
madhuriks
149 100+
i got it...this question is closed..
Jul 21 '10 #2
Dormilich
8,658 Expert Mod 8TB
line 25. you return from the function. any code after that cannot be processed.
Jul 21 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
41
by: Gérard Talbot | last post by:
Cross-posted to: comp.infosystems.www.authoring.html and alt.html Followup-to: comp.infosystems.www.authoring.html 1- One day, I stumbled across a website that offers to validate webpages. What...
3
by: Kent Ogletree | last post by:
I am porting a Java XML Validation class over to C# and I am having a problem finding exactly what I need to acomplish the task. First I need to test for well formedness. I know this is usually...
4
by: | last post by:
Hello Guys, I am using the validation controls to validate my data. But the problem is "The page is still being posted to server". I want to get rid of the round trips to server. Are there...
3
by: john morales | last post by:
Hi guys, I have a problem and i know there must be a solution for this as it is such a basic common practice in asp.net development. Scenario: i have many webforms in a site, most with two...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
2
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation....
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.