adressing formfields named with php array variables

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 32
Joined: Tue Jul 30, 2002 11:27 pm

Tue Nov 25, 2003 7:31 am

Hi there,

I have a formular, where I named some of the textfields:
field[0], field[1], etc...
others I named word[0], word[1], etc...
Now I want to reset only some fields with a button. F.e. all 'fields' or all 'words'.
A document.formname.field.value=""; or something like that doesn't work, because I seemingly can't use fieldnames, which include brackets.

Any idea?

Thanks Alex

php-forum Active User
php-forum Active User
Posts: 264
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Tue Nov 25, 2003 7:53 am

since you will be using JS, you could use eval()

and name your fields field0, field1....

then try something like this, tho i am not making any guarantees:



Post Reply