Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 613751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:02:14+00:00 2026-05-13T18:02:14+00:00

Hi I’m trying to create a simple registration form with ajax validation. I’ve got

  • 0

Hi I’m trying to create a simple registration form with ajax validation. I’ve got the form working almost how I’d like… a message appears on the page with the errors for each field entered incorrectly.

The problem is all the error messages appear in one div together and I would like to have each field have its own div containing only its own error.

I think I need to wrap my error messages in xml and use something like this –

document.getElementById("feedback1").innerHTML= xmlDoc.getElementsByTagName("lname")[0].childNodes[0].nodeValue; 

– but can’t seem to get it working

Does anyone know how I should modify my code to do this?

Here is my source containing the 3 file I’m currently using – http://www.cultivatedesigns.ca/Uploads/ajax-validation.zip

And Here is my code for my ajax page only.

 var xmlHttp;

function regForm(thisform) {
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null) {
 alert ("Browser does not support HTTP Request");
 return;
 }
 var formdata = "";
 formdata = "lname=" + thisform.elements['lname'].value + "&fname=" + thisform.elements['fname'].value + "&email=" + thisform.elements['email'].value + "&username=" + thisform.elements['username'].value + "&pass=" + thisform.elements['pass'].value + "&pass2=" + thisform.elements['pass2'].value;
    xmlHttp.onreadystatechange=formSubmitted;
    xmlHttp.open("POST", "adduser.php",true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", formdata.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(formdata);
    return false;
}

function formSubmitted() {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
    xmlDoc=xmlHttp.responseXML;
document.getElementById("feedback").innerHTML = xmlHttp.responseText;
//document.getElementById("feedback1").innerHTML= xmlDoc.getElementsByTagName("lname")[0].childNodes[0].nodeValue;
    }
}

function GetXmlHttpObject() {
xmlHttp=null;
try
 {
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:02:15+00:00Added an answer on May 13, 2026 at 6:02 pm

    found out my problem it was just that my errors weren’t being wrapped in an xml parent tag.

    I so I had something like this

    echo "<fname> </fname>";    
    echo "<lname> </lname>";    
    

    And It should have been like this.

    echo "<errors>";        
    echo "<fname> </fname>";    
    echo "<lname> </lname>";
    ehco "</errors>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.