Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic naming of text box and combo box

843838Jun 29 2007 — edited Jul 5 2007
hi!!! i m creating website ...i m using ajax.When tga page loads..there are 2 combo box one for state and other for city.on select of state city will get populated and on select of city my age will dynamically generate textbox along with combo box.This dynamically generated textbox will contain all the pincode for a particular selected city. and the combo box will contain all the username .

/*code*/

function processRequest()
{
document.getElementById(ele).options.length = 0;
document.getElementById(ele).options[0] = new Option("Select "+ ele,"0");
if (req.readyState == 4)
{
if(req.status == 200)
{
//get the text send by the servlet
textToSplit = req.responseText;
//Split the document
returnElements=textToSplit.split("||")
for ( var i=0; i<returnElements.length; i++ )
{
valueLabelPair = returnElements.split(";")
if(valueLabelPair[0]=="") break;
document.getElementById(ele).options[i+1] = new Option(valueLabelPair[1], valueLabelPair[0]);
var rows=document.getElementById("pinTabel").rows.length;
var oCell.innerHTML=<input type='text' name='pincode' value='+valueLabelPair[0]+'>

}
}
else
{
alert("Error loading page\n"+ req.status +":"+ req.statusText);
}

}
}

my problem is if there are 10 dynamic textbox.then name="pincode' is working only for the first text box..... is der any way to make name='pincode1'for the second textbox..and so on..
i also treid doing some thing like this<input type='text' name=pincode<%=i%>
but is giving error saying ..i cannot be resolved..wat do i do???plz help me out..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 2 2007
Added on Jun 29 2007
11 comments
171 views