Dear All,
I have a drop down list. Based on the selection I will create more drop down list depending on the selection of the first drop down list. Example if first I select the value as 3 then three drop down list will be created below. Thus now my problem how to validate those drop drop list which I have created dynamically.Thank you.

How do you want to validate them? How are you adding the dropdowns? Can we get some code samples? Are you using jQuery?

Dea Stbuchok,
Current below is how I do it? On change of the main drop down I call this function and populate it accordingly. I have a specific table so whatever previous rows I will remove and put new rows for this table document.getElementById('myTable');. I am still working on it using javascript but is very tedious.

function getSlaves(str,entID)
var table = document.getElementById('myTable');               
var rowCount = table.rows.length; 
//alert("Slaves Row count : "+rowCount);
	for(var i=4; i<rowCount; i++) 
		var row = table.rows[i];                 

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
      var totalSlave = Number(str)+5;
      var slaveIndex=1;
	      var x=document.getElementById('myTable').insertRow(j); 
	      var y=x.insertCell(0); 
	      var z=x.insertCell(1); 
	      y.innerHTML="<label class=description for=element_1>Slave <font color='red'>*</font></label> "; 
	      z.innerHTML="<select class='select' id='slaveID"+slaveIndex+"' name='slaveID"+slaveIndex+"' >"+xmlhttp.responseText; 
        //var a=document.getElementById('myTable').insertRow(j); 
	      //var b=a.insertCell(0); 
	      ///var c=a.insertCell(1); 
	      //c.innerHTML="<p class=error id='slaveID"+slaveIndex"+Error'>;  



What is the problem ? Doesn't the validation run ?

Dear Zero13,
It runs ok with javascript do you think I should adap jquery or leave it.Now it runs no problem but I got funny problem when I post it over using php I can see the dynamic value only in IE not in firefox and chrome. This is a new problem I am facing now.

Try to alert value after requesting the XMLHttpRequest, and check what is the difference between IE and others.

Dear Zero13,
What values should I alert and where exactly do you want me to alert? Thank you. Do you mean xmlhttp=new XMLHttpRequest(); alert("Something")?

It is for debugging. I've no idea where the problem is. It's just only for approaching the problem and debugging. Can you point me the focus if you know where the problem originate ?


Dear Zero13,
I am also lost cause is working well for IE and not the rest that is where I am also lost and confuse. I am also looking where could be the problem.