473,320 Members | 1,876 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,320 software developers and data experts.

How to validate data in XML file is equal or not to the entered data

149 100+
hi,
i tried to validate the data in XML file is present or not using the Ajax...here is the code...can anyone check it and provide me the solution...it is not validating the data..waiting for the reply...

Expand|Select|Wrap|Line Numbers
  1. function validate()
  2. {
  3.     if (document.frm.id.value == "")
  4.     {
  5.         alert("Enter Package Name");
  6.         document.frm.id.focus();
  7.         return (false);
  8.     }
  9.     chkId=/^[WAP_]{4}\d{2}$/;
  10.     if (chkId.test(document.frm.id.value))
  11.     {}
  12.     else
  13.     {
  14.        alert('Invalid \"Pack Name\" Entry');
  15.        return false;
  16.     }
  17.     if (document.frm.act.value == "")
  18.     {
  19.         alert("Enter Activation Status");
  20.         document.frm.act.focus();
  21.         return (false);
  22.     }
  23.     chkAct=/^[MA]{2}\d{2}$/;
  24.     if (chkAct.test(document.frm.act.value))
  25.     {}
  26.     else
  27.     {
  28.     alert('Invalid \"Activation Status\" Entry');
  29.     return false;
  30.     }
  31.     if (document.frm.deact.value == "")
  32.     {
  33.         alert("Enter De-Activation Status");
  34.         document.frm.deact.focus();
  35.         return (false);
  36.     }
  37.     chkDeact=/^[MD]{2}\d{2}$/;
  38.     if (chkDeact.test(document.frm.deact.value))
  39.     {}
  40.     else
  41.     {
  42.     alert('Invalid \"De-Activation Status\" Entry');
  43.     return false;
  44.     }
  45.     if (document.frm.allwpp.selectedIndex < 0)
  46.     {
  47.         alert("Select one of the \"Allow Post-Paid or Not\" options.");
  48.         document.frm.allwpp.focus();
  49.         return (false);
  50.     }
  51.     if (document.frm.allwpp.selectedIndex == 0)
  52.     {
  53.         alert("Select \"Allow Post-Paid or Not\" option.");
  54.         document.frm.allwpp.focus();
  55.         return (false);
  56.     }
  57.     if (document.frm.shrt.value == "")
  58.     {
  59.         alert("Enter Package Name");
  60.         document.frm.shrt.focus();
  61.         return (false);
  62.     }
  63.     return true;
  64. }
  65. function trim(stringToTrim)
  66. {
  67.     return stringToTrim.replace(/^\s+|\s+$/g,"");
  68. }
  69. function login()
  70. {
  71.     if(validate())
  72.     {
  73.         xmlHttp=GetXmlHttpObject();
  74.         if (window.XMLHttpRequest)
  75.         {
  76.             req = new XMLHttpRequest();
  77.         }
  78.         else if (window.ActiveXObject)
  79.         {
  80.             req = new ActiveXObject("Microsoft.XMLHTTP");
  81.         }
  82.         var id =document.getElementById("id").value;
  83.         var url="/xmlgprs/login.xml";
  84.         url=url+"?id="+id;
  85.         xmlHttp.onreadystatechange=stateChanged;
  86.         xmlHttp.open("GET",url,true);
  87.         xmlHttp.send(null);
  88.     }
  89. }
  90. function stateChanged()
  91. {
  92.     if (req.readyState == 4)
  93.     {
  94.         if (req.status == 200)
  95.         {
  96.             parseMsg();
  97.         }
  98.         else
  99.         {
  100.             alert("Unable to retrieve");
  101.         }
  102.     }
  103. }
  104. function parseMsg()
  105. {
  106.     response = req.responseXML.documentElement;
  107.     var node = response.getElementsByTagName(id);
  108.     var chkNode;
  109.     var chkNode1 = chkNode.equals(node);
  110.     idArray = new Array(); 
  111.     for(var i=0;i<chkNode1;i++)
  112.     {
  113.         var node1 = node.item(i);
  114.         idArray[i] = node1.text;
  115.     }
  116.     viewElement();
  117. }
  118. function viewElement()
  119. {
  120.     alert("valid");
  121.  
Thanks in advance,
madhu.
Jun 24 '10 #1
1 1539
Dormilich
8,658 Expert Mod 8TB
the solution has been discussed in your other threads.
Jun 24 '10 #2

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

Similar topics

1
by: Parzival | last post by:
I have a package that includes some data files. I am planning to use a distutils setup script to install the package. How can I compute a path name for such a data file that will always be relative...
8
by: Dean Speir | last post by:
Hi... I've been referred to this Newsgroup by the W3C Markup Validator FAQ. I've been happily using this Validator <http://validator.w3.org> for the past 18 months with great success, but...
2
by: st_moose | last post by:
I have a query that the user inputs last name of the customer and wants the output to be a specific form (that form is the form that all the information is entered originally). How do I set up the...
2
by: nepdae | last post by:
Please forgive me, this is a long one. My 11-user Access 2000 database is having recurring corruption problems. The symptoms include the following: 1) corrupted fields in recently created or...
0
by: Rebekh | last post by:
Hi I want to get the column name by using entered data.Is it possible? for e.g , i am having the entered data 'WROX' under the column name of EMP_NAME. I want to get the EMP_NAME using...
4
by: jdph40 | last post by:
I enter data into a database that resides on our network. Other employees can print reports from the database, but they have no way of telling if I've entered all the data. For instance, on...
2
by: gilly1471 | last post by:
Yep, new to perl, I started yesterday, but am quickly excelling. I would just like to know how to use user entered data. Let's say I have a programm that calculates the circumference of a circle....
3
by: JennDavila | last post by:
Hello, Not sure if my title was correct, but here is what I am dealing with. I have created a DB that contains different tables that are linked to a form through combo box's. I have createad a...
3
by: chuck gregory | last post by:
I'm using the 2002 (10.6771.6845) SP3 Access program. I have a form that will not show previously entered data. It has about 45 fields. I will call it the "parent" form. The "parent" form was at...
1
by: star01daisy | last post by:
This is what i have, but when i run the program the only thing that comes out is the inro line "This program opens...". What do i have to do for it to run smoothly.The program is supposed to sort the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.