NYCPHP Meetup

[nycphp-talk] Dynamic Textbox

Sajith A sajith.ml at gmail.com
Tue Jan 18 02:05:32 EST 2005


I'm trying to add dynamic textboxes in a form. 
The javscript function to add the textbox is this 
-----------------------------------------------------------------
function addAttribute()
{
	count++;
	divA = document.getElementById('divAttribute');
	divA.innerHTML = divA.innerHTML + ".... <input type='text'
name='attributes[]' maxlength='200' size='35'> .....";

}
-----------------------------------------------------------------
Inside the form i have a block "<div id='divAttribute'></div>" whose
contents will change when i click a button which calls the function
addAttribute();

Now the function is working fine except that in firefox, innerHTML is
not giving the value i typed into the textboxes. So each time i add a
textbox, the values i typed into the previously added textboxes are
lost. This is happening in firefox only. In ie it is working fine.
When i tried to list the elements in firefox, i found that the
dynamically added textboxes are not appearing in the list.
Yet gmail's "Attach a file" is working fine in mozilla. wondering what
they are doing...
Has anyone encountered a similar problem before? 
Any thoughts/alternatives?

---------------------------------
sâjîth
http://apilgrim.info
sajith.ml[at]gmail.com



More information about the talk mailing list